g1:name homonyms (question related to listx output)

Started by mahikeulbody, August 26, 2024, 09:23:22 AM

Previous topic - Next topic

mahikeulbody

Hi,

What happens if exiftool -g1name:tagname file and there are g1:tagname homonyms in the file ?

Could I assume that Exiftool will choice the first occurrence of g1name:tagname such as I could find into the listx output ?

Thanks.

StarGeek

I'm not sure what you mean by "g1:tagname homonyms". Do you mean duplicates?

There shouldn't be duplicate tags in the same group unless some program wrote the data very badly. If there is, exiftool will show both when the -a (-duplicates) option is used.

Otherwise, I believe it's usually whatever data was last read. And example of this is if you request a tag like GPSLatitude/GPSLongitude without asking for a group, e.g.
exiftool -GPSLatitude -GPSLongitude file.jpg
In this case, exiftool will use the values from Composite:GPSLatitude/Composite:GPSLongitude because Composite tags are always created last.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mahikeulbody

#2
I means tags with the same name and the same group name (i.e. g1 name) but a different g0 name. I can see many of them into the listx -f -s output.

With
exiftool -<g0 field>:<g1 field>:<tag name> <file>
there is none ambiguity.
With
exiftool -<g1 field>:<tag name> <file>
there is an ambiguity if there are duplicates for <g1 field>:<tag name>.

> Otherwise, I believe it's usually whatever data was last read.

Do you mean "last tag read into the file which has a g1name as required in the command" ? You can confirm that ?

Anyway, I have the same question about
exiftool -<g1 field>:<tag name>=<value>  <file>
In this case, how Exiftool decides which g0 name to choices to write the value in case of duplicates.

StarGeek

Quote from: mahikeulbody on August 26, 2024, 11:25:36 AMI means tags with the same name and the same group name (i.e. g1 name) but a different g0 name. I can see many of them into the listx -f -s output.

With exiftool -<g0 field>:<g1 field>:<tag name> <file> there is none ambiguity.
With exiftool -<g1 field>:<tag name> <file> there is an ambiguity if there are duplicates for <g1 field>:<tag name>.

It can't happen. There is no ambiguity. Group 0 names are general. Group 1 names are specific. Writing to G1:TAG will always only write the exact tag with that name. You can't have a Group 1 name appear in multiple Group 0s.

Quote> Otherwise, I believe it's usually whatever data was last read.

Do you mean "last tag read into the file which has a g1name as required in the command" ? You can confirm that ?

I mean, generally, it depends upon the position in the file. For example, Headline can appear in XMP and IPTC. If you use this command, no group names and including the -a option
exiftool -Headline file.jpg
the value of Headline will be dependent upon the position of the IPTC and XMP in the file. If the XMP data comes last, then Headline will have the value of the XMP:Headline tag. And if the IPTC data comes last, the value of the IPTC:Headline.

I believe Phil has some options when it comes to priority though.

Last time I looked into it, quite some time ago, exiftool would usually write the IPTC data before the XMP data.

QuoteAnyway, I have the same question about exiftool -<g1 field>:<tag name>=<value>  <file>. In this case, how Exiftool decides which g0 name to choices to write the value in case of duplicates.

The G1:Tag names are always the exact address. There is never any ambiguity in this. There can be ambiguity if you write G0:Tag name. Though in cases like this, exiftool usually marks most of them as Avoid for writing and will write to the most commonly used one.

For example, XMP:Rating could refer to multiple tags, XMP-dex:Rating, XMP-iptcExt:Rating, XMP-prism:Rating, XMP-xmp:Rating, and XMP-acdsee:Rating. But exiftool will only write to XMP-xmp:Rating and the others (except for XMP-iptcExt:Rating) are marked as Avoid, so the only way to write those is to use the Group 1 name.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mahikeulbody

#4
> You can't have a Group 1 name appear in multiple Group 0s.

Ok, I understood what happened. I made a little python script to analyze the listx output and it detects duplicates such as many lines g1='Casio'. But checking by myself after your answer, i can see these duplicates have the same g0 name, indeed, but come from different tables (table name='Casio::Main' and <table name='Casio::QVCI' and other ones in this case).

Thank you for the answer on the others points. It is more clear for me now.