On ven, 2007-07-20 at 17:03 -0700, Terry Carroll wrote:

> 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]
> #####################################################

Waou ! . GĂ©nial Terry ! (thanks a lot !) . Here's a little adaptation :

>>> import Image, ExifTags
>>> i=Image.open("p4120024.jpg")
>>> exifdata=i._getexif()
>>> for key, value in zip(exifdata.keys(), exifdata.values()) :
...     try :
...             if ExifTags.TAGS[key]=='MakerNote' :
...                     print " "
...             else :
...                     print ExifTags.TAGS[key], " --> ", value
...     except KeyError :
...             print " "
...
ExifVersion  -->  0220
ComponentsConfiguration  -->
CompressedBitsPerPixel  -->  (2, 1)
DateTimeOriginal  -->  2004:04:12 17:04:49
DateTimeDigitized  -->  2004:04:12 17:04:49
MaxApertureValue  -->  (43, 10)
UserComment
-->                                                                
MeteringMode  -->  5
LightSource  -->  0
Flash  -->  24
FocalLength  -->  (128, 10)
ExifImageWidth  -->  640
ImageDescription  -->  OLYMPUS DIGITAL CAMERA
Make  -->  OLYMPUS OPTICAL CO.,LTD
Model  -->  X200,D560Z,C350Z
Orientation  -->  1
YCbCrPositioning  -->  2


XResolution  -->  (72, 1)
YResolution  -->  (72, 1)
ExposureTime  -->  (10, 1000)
FileSource  -->
ExifInteroperabilityOffset  -->  1268
ExposureProgram  -->  2
ColorSpace  -->  1

ISOSpeedRatings  -->  64
ResolutionUnit  -->  2


FNumber  -->  (44, 10)
Software  -->  v751-81
DateTime  -->  2004:04:12 17:04:49

SceneType  -->


FlashPixVersion  -->  0100

ExifImageHeight  -->  480

ExifOffset  -->  550


-- 
Venez faire un tour ici :
http://monsitt.irruption.net
http://ekd.tolosano.info
http://irruption.net/progdudim

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

Reply via email to