Esempio n. 1
0
    def test_resize_animated_gif(self):
        with open('tests/images/newtons_cradle.gif', 'rb') as f:
            backend = pillow_backend.PillowBackend.from_file(f)

        pillow_backend.resize(self.backend, 100, 75)

        self.assertFalse(pillow_backend.has_alpha(backend))
        self.assertTrue(pillow_backend.has_animation(backend))
Esempio n. 2
0
    def test_transparent_gif(self):
        with open('tests/images/transparent.gif', 'rb') as f:
            backend = pillow_backend.PillowBackend.from_file(f)

        self.assertTrue(pillow_backend.has_alpha(backend))
        self.assertFalse(pillow_backend.has_animation(backend))

        # Check that the alpha of pixel 1,1 is 0
        self.assertEqual(backend.image.convert('RGBA').getpixel((1, 1))[3], 0)
Esempio n. 3
0
    def test_save_transparent_gif(self):
        with open('tests/images/transparent.gif', 'rb') as f:
            backend = pillow_backend.PillowBackend.from_file(f)

        # Save it into memory
        f = io.BytesIO()
        pillow_backend.save_as_gif(backend, f)

        # Reload it
        f.seek(0)
        backend = pillow_backend.PillowBackend.from_file(f)

        self.assertTrue(pillow_backend.has_alpha(backend))
        self.assertFalse(pillow_backend.has_animation(backend))

        # Check that the alpha of pixel 1,1 is 0
        self.assertEqual(backend.image.convert('RGBA').getpixel((1, 1))[3], 0)
Esempio n. 4
0
 def test_has_animation(self):
     has_animation = pillow_backend.has_animation(self.backend)
     self.assertFalse(has_animation)