mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
Merge pull request #2193 from SemanticsOS/lambdafu/libtiff-icc
Update info.icc_profile when using libtiff reader.
This commit is contained in:
commit
86606022c5
|
@ -1006,9 +1006,6 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
# Section 14: Differencing Predictor
|
# Section 14: Differencing Predictor
|
||||||
self.decoderconfig = (self.tag_v2[PREDICTOR],)
|
self.decoderconfig = (self.tag_v2[PREDICTOR],)
|
||||||
|
|
||||||
if ICCPROFILE in self.tag_v2:
|
|
||||||
self.info['icc_profile'] = self.tag_v2[ICCPROFILE]
|
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
@ -1281,6 +1278,10 @@ class TiffImageFile(ImageFile.ImageFile):
|
||||||
print("- unsupported data organization")
|
print("- unsupported data organization")
|
||||||
raise SyntaxError("unknown data organization")
|
raise SyntaxError("unknown data organization")
|
||||||
|
|
||||||
|
# Fix up info.
|
||||||
|
if ICCPROFILE in self.tag_v2:
|
||||||
|
self.info['icc_profile'] = self.tag_v2[ICCPROFILE]
|
||||||
|
|
||||||
# fixup palette descriptor
|
# fixup palette descriptor
|
||||||
|
|
||||||
if self.mode == "P":
|
if self.mode == "P":
|
||||||
|
|
|
@ -521,8 +521,16 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
except:
|
except:
|
||||||
self.fail("Should not get permission error here")
|
self.fail("Should not get permission error here")
|
||||||
|
|
||||||
|
def test_read_icc(self):
|
||||||
|
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
||||||
|
icc = img.info.get('icc_profile')
|
||||||
|
self.assertNotEqual(icc, None)
|
||||||
|
TiffImagePlugin.READ_LIBTIFF = True
|
||||||
|
with Image.open("Tests/images/hopper.iccprofile.tif") as img:
|
||||||
|
icc_libtiff = img.info.get('icc_profile')
|
||||||
|
self.assertNotEqual(icc_libtiff, None)
|
||||||
|
TiffImagePlugin.READ_LIBTIFF = False
|
||||||
|
self.assertEqual(icc, icc_libtiff)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user