Skip to content

Commit

Permalink
Merge pull request #6148 from radarhere/gif_size
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 26, 2022
2 parents 8107098 + d806227 commit aeba11d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Tests/test_file_gif.py
Expand Up @@ -982,6 +982,11 @@ def test_lzw_bits():
def test_extents():
with Image.open("Tests/images/test_extents.gif") as im:
assert im.size == (100, 100)

# Check that n_frames does not change the size
assert im.n_frames == 2
assert im.size == (100, 100)

im.seek(1)
assert im.size == (150, 150)

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/GifImagePlugin.py
Expand Up @@ -261,7 +261,7 @@ def _seek(self, frame, update_image=True):
# 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]:
if (x1 > self.size[0] or y1 > self.size[1]) and update_image:
self._size = max(x1, self.size[0]), max(y1, self.size[1])
self.dispose_extent = x0, y0, x1, y1
flags = s[8]
Expand Down

0 comments on commit aeba11d

Please sign in to comment.