On Fri, 20 Jul 2007, Nicolas Pinault wrote:

> I'd like to extract exif data from jpeg iages.
> Here what I do :
> 
> import Image
> i = Image.open ("my picture.jpeg")
> i.info["exif"]

I don't know what to do with that raw data. 

An alternate approach: i._getexif will give you a dictionary of EXIF data,
and the keys are documented in the dictionary ExifData.TAGS.  Here's a
quickie example:

#####################################################
import Image, ExifTags
i = Image.open ("81224044_fa8bc97c54_o.jpg")
exifdata = i._getexif()
print "tags found in image exif data:"
for key in exifdata.keys():
    try:     
        print " ", ExifTags.TAGS[key]
    except KeyError:
        print " *** Unsupported EXIF tag no. %s" % key

print "a few selected tags:"
print " ExifVersion:", exifdata[36864]  
print " Make:", exifdata[271]   
print " Model:", exifdata[272]
#####################################################


Prints (for this image of mine):
#####################################################
tags found in image exif data:
  ExifVersion
  ComponentsConfiguration
  ApertureValue
  DateTimeOriginal
  DateTimeDigitized
  ExifInteroperabilityOffset
  FlashPixVersion
  MeteringMode
  Flash
  FocalLength
  ExifImageWidth
  FocalPlaneXResolution
  Make
  Model
  Orientation
  YCbCrPositioning
  XResolution
  YResolution
  ExposureTime
  ExposureProgram
  ColorSpace
  UserComment
  ISOSpeedRatings
  ResolutionUnit
   *** Unsupported EXIF tag no. 41987
  FNumber
  DateTime
   *** Unsupported EXIF tag no. 41985
   *** Unsupported EXIF tag no. 41990
  FocalPlaneYResolution
  ExifImageHeight
  FocalPlaneResolutionUnit
   *** Unsupported EXIF tag no. 41986
  ExifOffset
  MakerNote
a few selected tags:
 ExifVersion: 0221
 Make: Canon
 Model: Canon EOS DIGITAL REBEL XT
#####################################################




_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to