Merge pull request #3822 from radarhere/tile

Expand GIF to include frames with extents outside the image size
This commit is contained in:
Hugo 2019-05-04 18:46:49 +03:00 committed by GitHub
commit 5090bba463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

View File

@ -663,3 +663,9 @@ class TestFileGif(PillowTestCase):
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
# codec error prepatch
im.load()
def test_extents(self):
im = Image.open('Tests/images/test_extents.gif')
self.assertEqual(im.size, (100, 100))
im.seek(1)
self.assertEqual(im.size, (150, 150))

View File

@ -233,6 +233,8 @@ class GifImageFile(ImageFile.ImageFile):
# extent
x0, y0 = i16(s[0:]), i16(s[2:])
x1, y1 = x0 + i16(s[4:]), y0 + i16(s[6:])
if x1 > self.size[0] or y1 > self.size[1]:
self._size = max(x1, self.size[0]), max(y1, self.size[1])
self.dispose_extent = x0, y0, x1, y1
flags = i8(s[8])