mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Expand GIF to include frames with extents outside the image size
This commit is contained in:
parent
c47792caeb
commit
27134340f5
BIN
Tests/images/test_extents.gif
Normal file
BIN
Tests/images/test_extents.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 368 B |
|
@ -663,3 +663,9 @@ class TestFileGif(PillowTestCase):
|
||||||
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
|
self.assertEqual(im.tile[0][3][0], 11) # LZW bits
|
||||||
# codec error prepatch
|
# codec error prepatch
|
||||||
im.load()
|
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))
|
||||||
|
|
|
@ -233,6 +233,8 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
# extent
|
# extent
|
||||||
x0, y0 = i16(s[0:]), i16(s[2:])
|
x0, y0 = i16(s[0:]), i16(s[2:])
|
||||||
x1, y1 = x0 + i16(s[4:]), y0 + i16(s[6:])
|
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
|
self.dispose_extent = x0, y0, x1, y1
|
||||||
flags = i8(s[8])
|
flags = i8(s[8])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user