[Image-SIG] how to get exif information

Fredrik Lundh fredrik at pythonware.com
Tue Jan 31 23:03:59 CET 2006


Winfried Diehm wrote:

> got pil 1.1.5 installed and running.
> Want to get exif information from jpeg-images. When I open an image, the image
> has a method info. This method returns a dict with one key. The value is a
> string with 14403 characters. For example:
> >>> im.info.keys()
> ['exif']
> >>> im.info["exif"][0:20]
> 'Exif\x00\x00II*\x00\x08\x00\x00\x00\x0b\x00\x0e\x01\x02\x00'
> How can I get the exif information (human readable;-) out of the string ?

try calling the _getexif() method on the im object.  if successful, this
method returns a dictionary mapping exif tags to corresponding values.

(the ExifTags module contains a dictionary mapping tag values to tag
names).

for a little more information, and some useful links, see this post:

    http://mail.python.org/pipermail/image-sig/2005-July/003427.html

</F>





More information about the Image-SIG mailing list