Specific fix for issue #2278, save fails with PhotoshopInfo tag

This commit is contained in:
Eric Soroos 2017-09-05 16:19:18 +00:00 committed by wiredfool
parent 1f61c4efd4
commit 1f4699ca5b
2 changed files with 9 additions and 2 deletions

View File

@ -1011,8 +1011,10 @@ class TiffImageFile(ImageFile.ImageFile):
args = rawmode, "" args = rawmode, ""
if JPEGTABLES in self.tag_v2: if JPEGTABLES in self.tag_v2:
# Hack to handle abbreviated JPEG headers # Hack to handle abbreviated JPEG headers
# FIXME This will fail with more than one value # Definition of JPEGTABLES is that the count
self.tile_prefix, = self.tag_v2[JPEGTABLES] # is the number of bytes in the tables datastream
# so, it should always be 1 in our tag info
self.tile_prefix = self.tag_v2[JPEGTABLES]
elif compression == "packbits": elif compression == "packbits":
args = rawmode args = rawmode
elif compression == "tiff_lzw": elif compression == "tiff_lzw":

View File

@ -142,6 +142,8 @@ TAGS_V2 = {
341: ("SMaxSampleValue", DOUBLE, 0), 341: ("SMaxSampleValue", DOUBLE, 0),
342: ("TransferRange", SHORT, 6), 342: ("TransferRange", SHORT, 6),
347: ("JPEGTables", UNDEFINED, 1),
# obsolete JPEG tags # obsolete JPEG tags
512: ("JPEGProc", SHORT, 1), 512: ("JPEGProc", SHORT, 1),
513: ("JPEGInterchangeFormat", LONG, 1), 513: ("JPEGInterchangeFormat", LONG, 1),
@ -158,7 +160,10 @@ TAGS_V2 = {
531: ("YCbCrPositioning", SHORT, 1), 531: ("YCbCrPositioning", SHORT, 1),
532: ("ReferenceBlackWhite", LONG, 0), 532: ("ReferenceBlackWhite", LONG, 0),
700: ('XMP', BYTE, 1),
33432: ("Copyright", ASCII, 1), 33432: ("Copyright", ASCII, 1),
34377: ('PhotoshopInfo', BYTE, 1),
# FIXME add more tags here # FIXME add more tags here
34665: ("ExifIFD", SHORT, 1), 34665: ("ExifIFD", SHORT, 1),