mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-05 21:53:15 +03:00
Different TIFF frames may have different compression
This commit is contained in:
parent
4d234fb54d
commit
886a7cf206
|
@ -991,6 +991,11 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
if self.use_load_libtiff:
|
||||||
|
return self._load_libtiff()
|
||||||
|
return super(TiffImageFile, self).load()
|
||||||
|
|
||||||
def _load_libtiff(self):
|
def _load_libtiff(self):
|
||||||
""" Overload method triggered when we detect a compressed tiff
|
""" Overload method triggered when we detect a compressed tiff
|
||||||
Calls out to libtiff """
|
Calls out to libtiff """
|
||||||
|
@ -1136,6 +1141,7 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# build tile descriptors
|
# build tile descriptors
|
||||||
x = y = l = 0
|
x = y = l = 0
|
||||||
self.tile = []
|
self.tile = []
|
||||||
|
self.use_load_libtiff = False
|
||||||
if STRIPOFFSETS in self.tag_v2:
|
if STRIPOFFSETS in self.tag_v2:
|
||||||
# striped image
|
# striped image
|
||||||
offsets = self.tag_v2[STRIPOFFSETS]
|
offsets = self.tag_v2[STRIPOFFSETS]
|
||||||
|
@ -1158,10 +1164,9 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# function.
|
# function.
|
||||||
#
|
#
|
||||||
# Setup the one tile for the whole image, then
|
# Setup the one tile for the whole image, then
|
||||||
# replace the existing load function with our
|
# use the _load_libtiff function.
|
||||||
# _load_libtiff function.
|
|
||||||
|
|
||||||
self.load = self._load_libtiff
|
self.use_load_libtiff = True
|
||||||
|
|
||||||
# To be nice on memory footprint, if there's a
|
# To be nice on memory footprint, if there's a
|
||||||
# file descriptor, use that instead of reading
|
# file descriptor, use that instead of reading
|
||||||
|
|
Loading…
Reference in New Issue
Block a user