Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not clear GIF tile when checking number of frames #6455

Merged
merged 1 commit into from Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added Tests/images/comment_after_only_frame.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Tests/test_file_gif.py
Expand Up @@ -399,6 +399,11 @@ def test_no_change():
assert im.is_animated
assert_image_equal(im, expected)

with Image.open("Tests/images/comment_after_only_frame.gif") as im:
expected = Image.new("P", (1, 1))
assert not im.is_animated
assert_image_equal(im, expected)


def test_eoferror():
with Image.open(TEST_GIF) as im:
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/GifImagePlugin.py
Expand Up @@ -185,8 +185,6 @@ def _seek(self, frame, update_image=True):
if not s or s == b";":
raise EOFError

self.tile = []

palette = None

info = {}
Expand Down Expand Up @@ -295,6 +293,8 @@ def _seek(self, frame, update_image=True):
if not update_image:
return

self.tile = []

if self.dispose:
self.im.paste(self.dispose, self.dispose_extent)

Expand Down