Exemplo n.º 1
0
 def image_manual_crop(self,
                       src_path,
                       dest_path=None):  # sizes: (left, top, right, bottom)
     if isinstance(self._image_params['crop'], tuple) != (0, 0, 0, 0):
         image = Image(src_path=src_path)
         image.crop_manual_with_offsets(offsets=self._image_params['crop'],
                                        dest_path=dest_path)
         image.close()
Exemplo n.º 2
0
    def test_manual_crop_with_offsets(self):
        for file in files_paths:
            fs.unlink(root_path + file[1])

            image = PilImage.open(root_path + file[0])
            sizes = image.size
            image.close()

            img = Image(root_path + file[0])
            img.crop_manual_with_offsets((10, 0, 0, 0), root_path + file[1])
            img.close()

            cropped_image = PilImage.open(root_path + file[1])
            cropped_sizes = cropped_image.size
            cropped_image.close()

            self.assertTrue((sizes[0] - cropped_sizes[0]) == 10)