From 73cf28cc9486cf3deda876bb24cdf1c701af0036 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 21 Feb 2022 15:57:13 +1100 Subject: [PATCH] If GIF has already seeked past first frame, it is animated --- src/PIL/GifImagePlugin.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 4f8ea209d..9005556e2 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -110,14 +110,16 @@ class GifImageFile(ImageFile.ImageFile): 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):