pyexiv2 - Empty XMP and ITPC Tags?

494 views Asked by At

I'm trying to manipulate an image's exif, XMP and ITPC tags with Python 2.7 and pyexiv2 in Windows 7. I can get a list of exif tags, but for some reason the XMP and ITPC lists are coming back empty, even though those tags exist in my test image (at least according to the mapping presented here. Anyone else run into this issue and been able to solve it? Many thanks for any feedback!

Code:

import pyexiv2

img = r'pathToImage'
metadata = pyexiv2.ImageMetadata(img)
metadata.read()
exifTags = metadata.exif_keys
print exifTags
xmpTags = metadata.xmp_keys
print xmpTags
iptcTags = metadata.iptc_keys
print iptcTags 
1

There are 1 answers

0
mi_st On

metada.exif_keys got you a list of EXIF tags from the image.

To view the keys with their respective values you might want to use a small loop:

for tag in exifTags: print exifTags[tag]

Additionaly you can use tag.value or tag.raw_value to access the values themselves.

You will find it all neatly explained in the pyexiv2 tutorial.