Permalink
Browse files

Merge c4cd036 into 6eb534b

  • Loading branch information...
homm committed Dec 7, 2017
2 parents 6eb534b + c4cd036 commit fe6ecd024dfcd820dd166455897f0f062c097fbc
Showing with 16 additions and 5 deletions.
  1. +16 −5 PIL/TiffImagePlugin.py
View
@@ -1186,12 +1186,23 @@ def _setup(self):
# for more exotic images.
sampleFormat = (1,)
bps_tuple = self.tag_v2.get(BITSPERSAMPLE, (1,))
extra_tuple = self.tag_v2.get(EXTRASAMPLES, ())
if photo in (2, 6, 8): # RGB, YCbCr, LAB
bps_count = 3
elif photo == 5:
bps_count = 4
else:
bps_count = 1
bps_count += len(extra_tuple)
# Some files have only one value in bps_tuple,
# while should have more. Fix it
if bps_count > len(bps_tuple) and len(bps_tuple) == 1:
bps_tuple = bps_tuple * bps_count
# mode: check photometric interpretation and bits per pixel
key = (
self.tag_v2.prefix, photo, sampleFormat, fillorder,
self.tag_v2.get(BITSPERSAMPLE, (1,)),
self.tag_v2.get(EXTRASAMPLES, ())
)
key = (self.tag_v2.prefix, photo, sampleFormat, fillorder,
bps_tuple, extra_tuple)
if DEBUG:
print("format key:", key)
try:

0 comments on commit fe6ecd0

Please sign in to comment.