A Python 3 binding to exiv2
py3exiv2 allows you to use the lib exiv2 into your Python 3 code.
exiv2 is a C++ library designed to handle the EXIF, IPTC and XMP image metadata.
With py3exiv2 you can read and write all standard metadata, create your own XMP namespace or extract the thumbnail embedded in image file.
py3exiv2 is the Python 3 version of pyexiv2 written for Python 2, if you're already using pyexiv2, you should be able to re-use your code with py3exiv2.
A minimal example:
>>> import pyexiv2
>>> data = pyexiv2.metadata.ImageMetadata('lena.jpg')
>>> data.read()
>>> for key in data.exif_keys:
... tag = data[key]
... print(' %-40s%s' %(key, tag.value))
...
Exif.Image.Make FUJIFILM
Exif.Image.Model FinePix S4800
Exif.Image.Orientation 6
Exif.Image.XResolution 72
Exif.Image.YResolution 72
Exif.Image.Software Digital Camera FinePix S4800 Ver1.00
Exif.Image.DateTime 2015-01-17 13:53:03
Exif.Photo.ExposureTime 1/110
Exif.Photo.FNumber 8
Exif.Photo.ExposureProgram 8
Exif.Photo.ISOSpeedRatings 64
Exif.Photo.ExifVersion 0230
Exif.Photo.ShutterSpeedValue 34/5
Exif.Photo.ApertureValue 6
Exif.Photo.BrightnessValue 421/50
Exif.Photo.ExposureBiasValue 0
Exif.Photo.MaxApertureValue 163/50
Exif.Photo.MeteringMode 5
Exif.Photo.Flash 16
Exif.Photo.FocalLength 43/10
............
Each datum key have a type and a description attributes.
>>> data['Exif.Photo.WhiteBalance'].type
'Short'
>>> data['Exif.Photo.UserComment'].description
'A tag for Exif users to write keywords or comments on the image besides those
in <ImageDescription>, and without the character code limitations of the
<ImageDescription> tag.'
The content of this site is published under CC BY-SA v3.0 licence Powered by Flask Hosted by Tuxfamily No Cookies No Cry!