mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 01:34:24 +03:00
If next byte ends the GIF, stay on the current frame
This commit is contained in:
parent
73cf28cc94
commit
590c616cfd
|
@ -154,9 +154,6 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
|
||||
if frame != self.__frame + 1:
|
||||
raise ValueError(f"cannot seek to frame {frame}")
|
||||
self.__frame = frame
|
||||
|
||||
self.tile = []
|
||||
|
||||
self.fp = self.__fp
|
||||
if self.__offset:
|
||||
|
@ -166,6 +163,14 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
pass
|
||||
self.__offset = 0
|
||||
|
||||
s = self.fp.read(1)
|
||||
if not s or s == b";":
|
||||
raise EOFError
|
||||
|
||||
self.__frame = frame
|
||||
|
||||
self.tile = []
|
||||
|
||||
if self.__frame == 1:
|
||||
self.pyaccess = None
|
||||
if "transparency" in self.info:
|
||||
|
@ -187,7 +192,8 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
interlace = None
|
||||
while True:
|
||||
|
||||
s = self.fp.read(1)
|
||||
if not s:
|
||||
s = self.fp.read(1)
|
||||
if not s or s == b";":
|
||||
break
|
||||
|
||||
|
@ -225,6 +231,7 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
info["comment"] = block
|
||||
block = self.data()
|
||||
s = None
|
||||
continue
|
||||
elif s[0] == 255:
|
||||
#
|
||||
|
@ -266,6 +273,7 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
pass
|
||||
# raise OSError, "illegal GIF tag `%x`" % s[0]
|
||||
s = None
|
||||
|
||||
frame_palette = palette or self.global_palette
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user