Merge pull request #4565 from radarhere/tiff_pickle

Fixed bug when unpickling TIFF images
This commit is contained in:
Hugo van Kemenade 2020-04-17 19:03:02 +03:00 committed by GitHub
commit ddebe27eed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -45,6 +45,7 @@ def helper_pickle_string(pickle, protocol, test_file, mode):
pytest.param(
"Tests/images/hopper.webp", None, marks=skip_unless_feature("webp")
),
("Tests/images/hopper.tif", None),
("Tests/images/test-card.png", None),
("Tests/images/zero_bb.png", None),
("Tests/images/zero_bb_scale2.png", None),

View File

@ -1066,7 +1066,7 @@ class TiffImageFile(ImageFile.ImageFile):
return self.__frame
def load(self):
if self.use_load_libtiff:
if self.tile and self.use_load_libtiff:
return self._load_libtiff()
return super().load()
@ -1094,12 +1094,7 @@ class TiffImageFile(ImageFile.ImageFile):
""" Overload method triggered when we detect a compressed tiff
Calls out to libtiff """
if self.tile is None:
raise OSError("cannot load this image")
pixel = Image.Image.load(self)
if not self.tile:
return pixel
Image.Image.load(self)
self.load_prepare()