On 6/5/05, Terry Carroll <[EMAIL PROTECTED]> wrote:
> Can anyone tell me if it's fairly easy to copy a JPEG file's EXIF data to
> another file.  Even better would be if this is doable in PIL.
> 
> My basic problem:
> 
> I've written a small program that reads a JPEG image in PIL, and creates a
> copy that is slightly modified (it overlays the image with a datestamp
> taken from the EXIF data), and saves it as a new file.  It all works
> swimmingly well, except that the ne file has no EXIF data.  I'd like to
> copy the original image's EXIF data to the new image.

You can *read* EXIF information via the _getexif() method of the
image. Use the KEYS dictionary in the ExifTags module to map numeric
keys to friendly names. For example,

>>> d = dict((ExifTags.TAGS[k], v) for k, v in im._getexif().items())
>>> d['DateTimeOriginal']
'2002:08:07 17:07:59'

Unfortunately, I don't know of a way to *write* EXIF information with PIL.

Hope this helps (a bit)
Paul.
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to