Beispiel #1
0
    def test_scr(self):
        with open(os.path.join(TEST_IMAGES_DIR, 'mr-scene.scr'), mode='rb') as f:
            img = PILConvertibleImage(f, name_hint='mr-scene.scr')
            output, size, format = img.create_thumbnail((200, 150))

        # with open(os.path.join(TEST_IMAGES_DIR, 'mr-scene.out.%s' % format), mode='wb') as f:
        #     f.write(output.getvalue())

        self.assertEqual(size, (200, 150))
        self.assertEqual(format, 'png')
        self.assertImagesSimilar(output, os.path.join(TEST_IMAGES_DIR, 'mr-scene.out.png'))
Beispiel #2
0
    def test_gif_palette(self):
        # https://github.com/python-pillow/Pillow/issues/513
        with open(os.path.join(TEST_IMAGES_DIR, 'atari-metal-knight.gif'), mode='rb') as f:
            img = PILConvertibleImage(f, name_hint='atari-metal-knight.gif')
            output, size, format = img.create_thumbnail((200, 150))

        # with open(os.path.join(TEST_IMAGES_DIR, 'atari-metal-knight.out.%s' % format), mode='wb') as f:
        #    f.write(output.getvalue())

        self.assertEqual(size, (200, 125))
        self.assertEqual(format, 'png')
        self.assertImagesSimilar(output, os.path.join(TEST_IMAGES_DIR, 'atari-metal-knight.out.png'))