EXIFTool option order

Started by chschmit, January 01, 2020, 08:15:44 PM

Previous topic - Next topic

chschmit

I would like the to concatenate some existing tags into existing tags:

I found that I need to break the effort into two scripts to get the correct output. When I tried to combine them into a single script, the output would work the first time, but if I ran it again it would keep appending the tags on the previous tag. Apparently the sequence of the options don't see to matter.

I thought this would work:
exiftool -ext JPG -r -k -progress -overwrite_original "-xmp-dc:Subject<IFD0:XPKeywords" "-IPTC:Keywords<IFD0:XPKeywords" "-XMP-lr:HierarchicalSubject<IFD0:XPKeywords" "-xmp-dc:Subject+<RegionPersonDisplayName" "-IPTC:Keywords+<RegionPersonDisplayName" "-XMP-lr:HierarchicalSubject+<RegionPersonDisplayName" %1


Instead I need to run these in succession to get the correct result:
exiftool -ext JPG -r -k -progress -overwrite_original "-xmp-dc:Subject<IFD0:XPKeywords" "-IPTC:Keywords<IFD0:XPKeywords" "-XMP-lr:HierarchicalSubject<IFD0:XPKeywords" %1

exiftool -ext JPG -r -k -progress -overwrite_original "-xmp-dc:Subject+<RegionPersonDisplayName" "-IPTC:Keywords+<RegionPersonDisplayName" "-XMP-lr:HierarchicalSubject+<RegionPersonDisplayName" %1

Any idea?

StarGeek

One problem is that you're copying XPKeywords, which is a string tag, into Subject and Keywords, which are list type tags.  So when you do that copy, then the entire content of XPKeywords is a single keyword.  In order to get it to copy correctly, you need to add the -sep option.  IIRC, XPKeywords uses a semicolon to separate the keywords, so you would have to add -sep ";"

Another problem seems to be the fact that you are doing a direct tag copy < for the XPKeywords, which will overwrite any pre-existing keywords, but doing an add tag copy +< for the RegionPersonDisplayName part.  The second part is always going to add the keywords, even if they already exist.  Exiftool doesn't check for duplicates when adding the data.  See FAQ #17 for more info and the Advanced formatting NoDups helper function for how to clean up duplicate entries.
"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

Phil Harvey

I think you may be trying to add a new item to the XMP-dc:Subject list being written with "+<", but what you need to to is use -addTagsFromFile @ to do this.  This is mentioned in the last example of FAQ 17.

- 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 ($).

chschmit

Thank you both.

I've arrived at the following script to convert Photo Gallery people regions and faces to MWG compliant tags as well as appending people names to the keywords for other software to be able to view it (ie, Lightroom).

exiftool -config convert_regions.config "-regioninfo<myregion" -ext JPG -r -k -progress -overwrite_original -sep ";" -addTagsFromFile @ "-xmp-dc:Subject<IFD0:XPKeywords" "-xmp-dc:Subject<RegionPersonDisplayName" "-IPTC:Keywords<IFD0:XPKeywords" "-IPTC:Keywords<RegionPersonDisplayName" "-XMP-lr:HierarchicalSubject<IFD0:XPKeywords" "-XMP-lr:HierarchicalSubject<RegionPersonDisplayName" "-XMP-IPTCExt:PersonInImage<RegionPersonDisplayName" "-XMP-mwg-rs:RegionName<RegionPersonDisplayName"  %1