TagNames with parentheses

Started by Guenter, August 09, 2012, 11:37:36 AM

Previous topic - Next topic

Guenter

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

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Guenter

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

Phil Harvey

Hi Guenter,

Yup, that's the way to do it.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).