def test_cmyk_jpg_preprocess(self):
        """Test preprocessing a CMYK image converts it to RGB."""
        instance = VersatileImageTestModel.objects.create(img_type='cmyk',
                                                          image='cmyk.jpg',
                                                          ppoi='0.5x0.5',
                                                          width=0,
                                                          height=0)
        processor = ProcessedImage(instance.image.name,
                                   instance.image.field.storage, True)
        image_info = processor.retrieve_image(instance.image.name)
        image, save_kwargs = processor.preprocess_JPEG(image_info[0])

        self.assertEqual(image.mode, 'RGB')
Exemplo n.º 2
0
 def test_transparent_gif_preprocess(self):
     """Test preprocessing a transparent gif image."""
     instance = VersatileImageTestModel.objects.create(
         img_type='tgif',
         image='transparent.gif',
         ppoi='1x1',
         width=0,
         height=0
     )
     processor = ProcessedImage(instance.image.name, instance.image.field.storage, True)
     image_info = processor.retrieve_image(instance.image.name)
     image, save_kwargs = processor.preprocess_GIF(image_info[0])
     self.assertEqual(save_kwargs['transparency'], image.info['transparency'])
    def test_cmyk_jpg_preprocess(self):
        """Test preprocessing a CMYK image converts it to RGB."""
        instance = VersatileImageTestModel.objects.create(
            img_type='cmyk',
            image='cmyk.jpg',
            ppoi='0.5x0.5',
            width=0,
            height=0
        )
        processor = ProcessedImage(instance.image.name, instance.image.field.storage, True)
        image_info = processor.retrieve_image(instance.image.name)
        image, save_kwargs = processor.preprocess_JPEG(image_info[0])

        self.assertEqual(image.mode, 'RGB')