Skip to content

Commit

Permalink
If GIF has already seeked past first frame, it is animated
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 21, 2022
1 parent 54be93c commit 73cf28c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/PIL/GifImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,16 @@ def is_animated(self):
self._is_animated = self._n_frames != 1
else:
current = self.tell()

try:
self.seek(1)
if current:
self._is_animated = True
except EOFError:
self._is_animated = False
else:
try:
self.seek(1)
self._is_animated = True
except EOFError:
self._is_animated = False

self.seek(current)
self.seek(current)
return self._is_animated

def seek(self, frame):
Expand Down

0 comments on commit 73cf28c

Please sign in to comment.