Beispiel #1
0
    def _create_background_image(self):
        """ Create the background image, which consists of the two images side-by-side with a colored backdrop.
        This must be recreated if the image size, padding, or background color changes. """
        self._calculate_image_positions()

        w, h = self._calculate_background_image_size()
        image = Image.blank(w, h)
        image.paste(self._image1, self._image1_position)
        image.paste(self._image2, self._image2_position)

        image, factor = self._rescale_to_max_size(image)
        self._background_image = image
        self._scale_factor = factor
Beispiel #2
0
 def inverse_transform_image(self, image, output_size):
     offset = - self._translation
     warped = Image.blank(output_size[0], output_size[1], image.channels)
     warped.paste(image, offset)
     return warped