Using the public interface rather than the raw, undecoded interface

This commit is contained in:
wiredfool 2013-10-07 17:00:20 -07:00
parent ce0e8b6abf
commit 951a5d4ce8

View File

@ -990,16 +990,12 @@ def _save(im, fp, filename):
# inspired by image-sig posting from Kevin Cazabon, kcazabon@home.com # inspired by image-sig posting from Kevin Cazabon, kcazabon@home.com
if hasattr(im, 'tag'): if hasattr(im, 'tag'):
# preserve tags from original TIFF image file # preserve tags from original TIFF image file
for key in (RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION): for key in (RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION,
if key in im.tag.tagdata: IPTC_NAA_CHUNK, PHOTOSHOP_CHUNK, XMP):
ifd[key] = im.tag.tagdata.get(key)
# preserve some more tags from original TIFF image file
# -- 2008-06-06 Florian Hoech
ifd.tagtype = im.tag.tagtype
for key in (IPTC_NAA_CHUNK, PHOTOSHOP_CHUNK, XMP):
if key in im.tag: if key in im.tag:
ifd[key] = im.tag[key] ifd[key] = im.tag[key]
ifd.tagtypes[key] = im.tag.tagtype.get(key, None)
# preserve ICC profile (should also work when saving other formats # preserve ICC profile (should also work when saving other formats
# which support profiles as TIFF) -- 2008-06-06 Florian Hoech # which support profiles as TIFF) -- 2008-06-06 Florian Hoech
if "icc_profile" in im.info: if "icc_profile" in im.info: