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?
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 (https://exiftool.org/exiftool_pod.html#sep-STR--separator). 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 (https://exiftool.org/faq.html#Q17) for more info and the Advanced formatting NoDups helper function (https://exiftool.org/exiftool_pod.html#Advanced-formatting-feature) for how to clean up duplicate entries.
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 (https://exiftool.org/faq.html#Q17).
- Phil
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