Skip to content

Commit

Permalink
Merge pull request #3822 from radarhere/tile
Browse files Browse the repository at this point in the history
Expand GIF to include frames with extents outside the image size
  • Loading branch information
hugovk committed May 4, 2019
2 parents 3e4b1a9 + 2713434 commit 5090bba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Binary file added Tests/images/test_extents.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Tests/test_file_gif.py
Expand Up @@ -663,3 +663,9 @@ def test_lzw_bits(self):
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))
2 changes: 2 additions & 0 deletions src/PIL/GifImagePlugin.py
Expand Up @@ -233,6 +233,8 @@ def _seek(self, frame):
# 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])

Expand Down

0 comments on commit 5090bba

Please sign in to comment.