ensure that the prevous frame was loaded when seek()ing

This commit is contained in:
Lars Jørgen Solberg 2014-07-07 20:46:54 +02:00
parent 047832c6c6
commit 925277cbfc

View File

@ -101,6 +101,10 @@ class GifImageFile(ImageFile.ImageFile):
self.__fp.seek(self.__rewind) self.__fp.seek(self.__rewind)
self._prev_im = None self._prev_im = None
self.disposal_method = 0 self.disposal_method = 0
else:
# ensure that the previous frame was loaded
if not self.im:
self.load()
if frame != self.__frame + 1: if frame != self.__frame + 1:
raise ValueError("cannot seek to frame %d" % frame) raise ValueError("cannot seek to frame %d" % frame)