mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Replace lena.gif with hopper.gif
This commit is contained in:
		
							parent
							
								
									b248dcd019
								
							
						
					
					
						commit
						d7f7965aa2
					
				
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 16 KiB  | 
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
from helper import unittest, PillowTestCase, lena, netpbm_available
 | 
					from helper import unittest, PillowTestCase, hopper, netpbm_available
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
from PIL import GifImagePlugin
 | 
					from PIL import GifImagePlugin
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,9 @@ from PIL import GifImagePlugin
 | 
				
			||||||
codecs = dir(Image.core)
 | 
					codecs = dir(Image.core)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# sample gif stream
 | 
					# sample gif stream
 | 
				
			||||||
file = "Tests/images/lena.gif"
 | 
					TEST_GIF = "Tests/images/hopper.gif"
 | 
				
			||||||
with open(file, "rb") as f:
 | 
					
 | 
				
			||||||
 | 
					with open(TEST_GIF, "rb") as f:
 | 
				
			||||||
    data = f.read()
 | 
					    data = f.read()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +19,7 @@ class TestFileGif(PillowTestCase):
 | 
				
			||||||
            self.skipTest("gif support not available")  # can this happen?
 | 
					            self.skipTest("gif support not available")  # can this happen?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_sanity(self):
 | 
					    def test_sanity(self):
 | 
				
			||||||
        im = Image.open(file)
 | 
					        im = Image.open(TEST_GIF)
 | 
				
			||||||
        im.load()
 | 
					        im.load()
 | 
				
			||||||
        self.assertEqual(im.mode, "P")
 | 
					        self.assertEqual(im.mode, "P")
 | 
				
			||||||
        self.assertEqual(im.size, (128, 128))
 | 
					        self.assertEqual(im.size, (128, 128))
 | 
				
			||||||
| 
						 | 
					@ -45,7 +46,7 @@ class TestFileGif(PillowTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_roundtrip(self):
 | 
					    def test_roundtrip(self):
 | 
				
			||||||
        out = self.tempfile('temp.gif')
 | 
					        out = self.tempfile('temp.gif')
 | 
				
			||||||
        im = lena()
 | 
					        im = hopper()
 | 
				
			||||||
        im.save(out)
 | 
					        im.save(out)
 | 
				
			||||||
        reread = Image.open(out)
 | 
					        reread = Image.open(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,17 +55,17 @@ class TestFileGif(PillowTestCase):
 | 
				
			||||||
    def test_roundtrip2(self):
 | 
					    def test_roundtrip2(self):
 | 
				
			||||||
        # see https://github.com/python-pillow/Pillow/issues/403
 | 
					        # see https://github.com/python-pillow/Pillow/issues/403
 | 
				
			||||||
        out = self.tempfile('temp.gif')
 | 
					        out = self.tempfile('temp.gif')
 | 
				
			||||||
        im = Image.open('Tests/images/lena.gif')
 | 
					        im = Image.open(TEST_GIF)
 | 
				
			||||||
        im2 = im.copy()
 | 
					        im2 = im.copy()
 | 
				
			||||||
        im2.save(out)
 | 
					        im2.save(out)
 | 
				
			||||||
        reread = Image.open(out)
 | 
					        reread = Image.open(out)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assert_image_similar(reread.convert('RGB'), lena(), 50)
 | 
					        self.assert_image_similar(reread.convert('RGB'), hopper(), 50)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_palette_handling(self):
 | 
					    def test_palette_handling(self):
 | 
				
			||||||
        # see https://github.com/python-pillow/Pillow/issues/513
 | 
					        # see https://github.com/python-pillow/Pillow/issues/513
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        im = Image.open('Tests/images/lena.gif')
 | 
					        im = Image.open(TEST_GIF)
 | 
				
			||||||
        im = im.convert('RGB')
 | 
					        im = im.convert('RGB')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        im = im.resize((100, 100), Image.ANTIALIAS)
 | 
					        im = im.resize((100, 100), Image.ANTIALIAS)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
from helper import unittest, PillowTestCase, lena
 | 
					from helper import unittest, PillowTestCase, hopper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image
 | 
					from PIL import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,21 +9,21 @@ class TestImageLoad(PillowTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_sanity(self):
 | 
					    def test_sanity(self):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        im = lena()
 | 
					        im = hopper()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pix = im.load()
 | 
					        pix = im.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertEqual(pix[0, 0], (223, 162, 133))
 | 
					        self.assertEqual(pix[0, 0], (20, 20, 70))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_close(self):
 | 
					    def test_close(self):
 | 
				
			||||||
        im = Image.open("Tests/images/lena.gif")
 | 
					        im = Image.open("Tests/images/hopper.gif")
 | 
				
			||||||
        im.close()
 | 
					        im.close()
 | 
				
			||||||
        self.assertRaises(ValueError, lambda: im.load())
 | 
					        self.assertRaises(ValueError, lambda: im.load())
 | 
				
			||||||
        self.assertRaises(ValueError, lambda: im.getpixel((0, 0)))
 | 
					        self.assertRaises(ValueError, lambda: im.getpixel((0, 0)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_contextmanager(self):
 | 
					    def test_contextmanager(self):
 | 
				
			||||||
        fn = None
 | 
					        fn = None
 | 
				
			||||||
        with Image.open("Tests/images/lena.gif") as im:
 | 
					        with Image.open("Tests/images/hopper.gif") as im:
 | 
				
			||||||
            fn = im.fp.fileno()
 | 
					            fn = im.fp.fileno()
 | 
				
			||||||
            os.fstat(fn)
 | 
					            os.fstat(fn)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,8 +6,8 @@ import shutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import Image, JpegImagePlugin, GifImagePlugin
 | 
					from PIL import Image, JpegImagePlugin, GifImagePlugin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_jpg = "Tests/images/lena.jpg"
 | 
					TEST_JPG = "Tests/images/hopper.jpg"
 | 
				
			||||||
test_gif = "Tests/images/lena.gif"
 | 
					TEST_GIF = "Tests/images/hopper.gif"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_filenames = (
 | 
					test_filenames = (
 | 
				
			||||||
    "temp_';",
 | 
					    "temp_';",
 | 
				
			||||||
| 
						 | 
					@ -31,24 +31,24 @@ class TestShellInjection(PillowTestCase):
 | 
				
			||||||
    def test_load_djpeg_filename(self):
 | 
					    def test_load_djpeg_filename(self):
 | 
				
			||||||
        for filename in test_filenames:
 | 
					        for filename in test_filenames:
 | 
				
			||||||
            src_file = self.tempfile(filename)
 | 
					            src_file = self.tempfile(filename)
 | 
				
			||||||
            shutil.copy(test_jpg, src_file)
 | 
					            shutil.copy(TEST_JPG, src_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            im = Image.open(src_file)
 | 
					            im = Image.open(src_file)
 | 
				
			||||||
            im.load_djpeg()
 | 
					            im.load_djpeg()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(cjpeg_available(), "cjpeg not available")
 | 
					    @unittest.skipUnless(cjpeg_available(), "cjpeg not available")
 | 
				
			||||||
    def test_save_cjpeg_filename(self):
 | 
					    def test_save_cjpeg_filename(self):
 | 
				
			||||||
        im = Image.open(test_jpg)
 | 
					        im = Image.open(TEST_JPG)
 | 
				
			||||||
        self.assert_save_filename_check(im, JpegImagePlugin._save_cjpeg)
 | 
					        self.assert_save_filename_check(im, JpegImagePlugin._save_cjpeg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(netpbm_available(), "netpbm not available")
 | 
					    @unittest.skipUnless(netpbm_available(), "netpbm not available")
 | 
				
			||||||
    def test_save_netpbm_filename_bmp_mode(self):
 | 
					    def test_save_netpbm_filename_bmp_mode(self):
 | 
				
			||||||
        im = Image.open(test_gif).convert("RGB")
 | 
					        im = Image.open(TEST_GIF).convert("RGB")
 | 
				
			||||||
        self.assert_save_filename_check(im, GifImagePlugin._save_netpbm)
 | 
					        self.assert_save_filename_check(im, GifImagePlugin._save_netpbm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @unittest.skipUnless(netpbm_available(), "netpbm not available")
 | 
					    @unittest.skipUnless(netpbm_available(), "netpbm not available")
 | 
				
			||||||
    def test_save_netpbm_filename_l_mode(self):
 | 
					    def test_save_netpbm_filename_l_mode(self):
 | 
				
			||||||
        im = Image.open(test_gif).convert("L")
 | 
					        im = Image.open(TEST_GIF).convert("L")
 | 
				
			||||||
        self.assert_save_filename_check(im, GifImagePlugin._save_netpbm)
 | 
					        self.assert_save_filename_check(im, GifImagePlugin._save_netpbm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								selftest.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								selftest.py
									
									
									
									
									
								
							| 
						 | 
					@ -49,13 +49,13 @@ def testimage():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Or open existing files:
 | 
					    Or open existing files:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.gif"))
 | 
					    >>> im = Image.open(os.path.join(ROOT, "Tests/images/hopper.gif"))
 | 
				
			||||||
    >>> _info(im)
 | 
					    >>> _info(im)
 | 
				
			||||||
    ('GIF', 'P', (128, 128))
 | 
					    ('GIF', 'P', (128, 128))
 | 
				
			||||||
    >>> _info(Image.open(os.path.join(ROOT, "Tests/images/lena.ppm")))
 | 
					    >>> _info(Image.open(os.path.join(ROOT, "Tests/images/hopper.ppm")))
 | 
				
			||||||
    ('PPM', 'RGB', (128, 128))
 | 
					    ('PPM', 'RGB', (128, 128))
 | 
				
			||||||
    >>> try:
 | 
					    >>> try:
 | 
				
			||||||
    ...  _info(Image.open(os.path.join(ROOT, "Tests/images/lena.jpg")))
 | 
					    ...  _info(Image.open(os.path.join(ROOT, "Tests/images/hopper.jpg")))
 | 
				
			||||||
    ... except IOError as v:
 | 
					    ... except IOError as v:
 | 
				
			||||||
    ...  print(v)
 | 
					    ...  print(v)
 | 
				
			||||||
    ('JPEG', 'RGB', (128, 128))
 | 
					    ('JPEG', 'RGB', (128, 128))
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ def testimage():
 | 
				
			||||||
    PIL doesn't actually load the image data until it's needed,
 | 
					    PIL doesn't actually load the image data until it's needed,
 | 
				
			||||||
    or you call the "load" method:
 | 
					    or you call the "load" method:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm"))
 | 
					    >>> im = Image.open(os.path.join(ROOT, "Tests/images/hopper.ppm"))
 | 
				
			||||||
    >>> print(im.im) # internal image attribute
 | 
					    >>> print(im.im) # internal image attribute
 | 
				
			||||||
    None
 | 
					    None
 | 
				
			||||||
    >>> a = im.load()
 | 
					    >>> a = im.load()
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ def testimage():
 | 
				
			||||||
    You can apply many different operations on images.  Most
 | 
					    You can apply many different operations on images.  Most
 | 
				
			||||||
    operations return a new image:
 | 
					    operations return a new image:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    >>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm"))
 | 
					    >>> im = Image.open(os.path.join(ROOT, "Tests/images/hopper.ppm"))
 | 
				
			||||||
    >>> _info(im.convert("L"))
 | 
					    >>> _info(im.convert("L"))
 | 
				
			||||||
    (None, 'L', (128, 128))
 | 
					    (None, 'L', (128, 128))
 | 
				
			||||||
    >>> _info(im.copy())
 | 
					    >>> _info(im.copy())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user