Skip to content

Commit

Permalink
Corrected tag counts (#4033)
Browse files Browse the repository at this point in the history
Corrected tag counts
  • Loading branch information
hugovk committed Sep 5, 2019
2 parents e776b71 + 7a16ef1 commit 572a93c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Tests/test_file_tiff_metadata.py
Expand Up @@ -239,11 +239,13 @@ def test_empty_values(self):
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()
Expand Down
5 changes: 3 additions & 2 deletions src/PIL/TiffTags.py
Expand Up @@ -175,9 +175,10 @@ def lookup(tag):
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),
33723: ("IptcNaaInfo", UNDEFINED, 0),
34377: ("PhotoshopInfo", BYTE, 0),
# FIXME add more tags here
34665: ("ExifIFD", LONG, 1),
34675: ("ICCProfile", UNDEFINED, 1),
Expand Down

0 comments on commit 572a93c

Please sign in to comment.