From 17ac15543d07a081f5fa357c1e7f89c41fea579d Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 2 Sep 2014 15:08:51 -0700 Subject: [PATCH] fp.tell resyncs the python3 with the file pointer --- PIL/TiffImagePlugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index abf9db7e3..50648288e 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -661,6 +661,9 @@ class TiffImageFile(ImageFile.ImageFile): if Image.DEBUG: print("Seeking to frame %s, on frame %s, __next %s, location: %s"% (frame, self.__frame, self.__next, self.fp.tell())) + # reset python3 buffered io handle in case fp + # was passed to libtiff, invalidating the buffer + self.fp.tell() self.fp.seek(self.__next) if Image.DEBUG: print("Loading tags, location: %s"%self.fp.tell())