Hey there,
when I print the tag names they often have a number in parentheses appended:
City (2)
What is this?
A counter if this tag exists more often?
And how to deal with it?
Can I simply remove this from the tag name to access this tag?
I read the tags with:
$xmp = ImageInfo($file, 'XMP:all', '-charset=UTF8');
foreach (keys %$xmp) {
print "$_ {$xmp->{$_}}
}
Thanks a lot
Guenter
Hi Guenter,
These are tag keys. In the description of the return value for ImageInfo():
The tag keys are identifiers, which are similar to the tag names but may have
an appended instance number if multiple tags with the same name were
extracted from the image.
Use GetTagName() to return the tag name given the tag key.
- Phil
Hi Phil,
is this the correct way to do it?
$xmp = ImageInfo($file, 'XMP:all', '-charset=UTF8');
foreach (keys %$xmp) {
$tagName = Image::ExifTool::GetTagName($_);
print "$tagName {$xmp->{$_}}";
}
It works, but maybe there is a better way to get a list of tag names and contents?
Tanks a lot
Guenter
Hi Guenter,
Yup, that's the way to do it.
- Phil