From f08a0966a089a5826b9f83329b2fee087910cdc7 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 19 Aug 2019 21:12:16 +1000 Subject: [PATCH] Corrected tag counts --- Tests/test_file_tiff_metadata.py | 6 ++++-- src/PIL/TiffTags.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Tests/test_file_tiff_metadata.py b/Tests/test_file_tiff_metadata.py index 8761e431e..c14723864 100644 --- a/Tests/test_file_tiff_metadata.py +++ b/Tests/test_file_tiff_metadata.py @@ -239,11 +239,13 @@ class TestFileTiffMetadata(PillowTestCase): def test_PhotoshopInfo(self): im = Image.open("Tests/images/issue_2278.tif") - self.assertIsInstance(im.tag_v2[34377], bytes) + self.assertEqual(len(im.tag_v2[34377]), 1) + self.assertIsInstance(im.tag_v2[34377][0], bytes) out = self.tempfile("temp.tiff") im.save(out) reloaded = Image.open(out) - self.assertIsInstance(reloaded.tag_v2[34377], bytes) + self.assertEqual(len(reloaded.tag_v2[34377]), 1) + self.assertIsInstance(reloaded.tag_v2[34377][0], bytes) def test_too_many_entries(self): ifd = TiffImagePlugin.ImageFileDirectory_v2() diff --git a/src/PIL/TiffTags.py b/src/PIL/TiffTags.py index f5a27be42..f53130c72 100644 --- a/src/PIL/TiffTags.py +++ b/src/PIL/TiffTags.py @@ -175,9 +175,9 @@ TAGS_V2 = { 530: ("YCbCrSubSampling", SHORT, 2), 531: ("YCbCrPositioning", SHORT, 1), 532: ("ReferenceBlackWhite", RATIONAL, 6), - 700: ("XMP", BYTE, 1), + 700: ("XMP", BYTE, 0), 33432: ("Copyright", ASCII, 1), - 34377: ("PhotoshopInfo", BYTE, 1), + 34377: ("PhotoshopInfo", BYTE, 0), # FIXME add more tags here 34665: ("ExifIFD", LONG, 1), 34675: ("ICCProfile", UNDEFINED, 1),