[Image-SIG] Copying Tiff tags to new image

Dennis Shimer dshimer at gmail.com
Thu Jan 11 12:42:03 CET 2007


I am doing some basic modification to existing TIFF files using PIL
(1.6 in python 2.5). When I open the image there is quite a bit of
info in the tags dict that I would like to save with the new image.
Apparently (based on other forums I've seen) once you process the
image all the TIFF specific data gets lost. I can copy the info but
can't find an example of how to copy or re-assign it to the new image.
For example

import Image,TiffImagePlugin
im=Image.open('oldname.tif','r')
tags=im.tag.tags
im.rotate(90,0).save('newname.tif')

will open an image named oldname.tif, save the tags, then save a new
image that has been rotated by 90. How can I assign those tags back to
the new image? Or what important concepts am I just totally missing?


More information about the Image-SIG mailing list