From 925277cbfcf881f04a5ace69f88a8b3f4ff5b992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20J=C3=B8rgen=20Solberg?= Date: Mon, 7 Jul 2014 20:46:54 +0200 Subject: [PATCH] ensure that the prevous frame was loaded when seek()ing --- PIL/GifImagePlugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PIL/GifImagePlugin.py b/PIL/GifImagePlugin.py index cb96b9c95..4107c6ba3 100644 --- a/PIL/GifImagePlugin.py +++ b/PIL/GifImagePlugin.py @@ -101,6 +101,10 @@ class GifImageFile(ImageFile.ImageFile): self.__fp.seek(self.__rewind) self._prev_im = None self.disposal_method = 0 + else: + # ensure that the previous frame was loaded + if not self.im: + self.load() if frame != self.__frame + 1: raise ValueError("cannot seek to frame %d" % frame)