<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def input(self, img):
 """Resize input image if necessary. Parameters img : `PIL.Image` Input image. Raises ------ ValueError If input image is too small. Returns ------- `PIL.Image` Resized image or input image. """

        img_width, img_height = img.size

        if self.resize:
            width, height = self.resize
            scale = min(width / img_width, height / img_height)
            img = img.resize((floor(img_width * scale),
                              floor(img_height * scale)))
            img_width, img_height = img.size

        if img_width < self.min_size or img_height < self.min_size:
            raise ValueError('input image is too small: {0} x {1} < {2} x {2}'
                             .format(img_width, img_height, self.min_size))

        return img