I am trying to replace tags in an existing XMP-iptcExt PersonInImage field using a command line argument file
I have read a couple of posts here which address this issue partially and I realize I do need to use the -addtagsfromfile option.
As I may well be trying to use this process to add several values to several individual tags: PersonInInage, Subject, Keywords ...
do I need to make sure this option appears only once?
You should need it just once unless you are copying from more than one file. This command would copy TAG2, TAG3, and TAG4 into TAG1, overwriting any previous contents of TAG1
exiftool -AddTagsFromFile @ "-TAG1<TAG2" "-TAG1<TAG3" "-TAG1<TAG4" file.jpg
This would copy TAG2 from from file.jpg, TAG3 from FileA.jpg, and TAG4 from FileB.jpg into TAG1 in file.jpg
exiftool -AddTagsFromFile @ "-TAG1<TAG2" -AddTagsFromFile FileA.jpg "-TAG1<TAG3" AddTagsFromFile FileB.jpg" -TAG1<TAG4" file.jpg
Thank you for the example, but my main question relates to whether I have to be very careful to not duplicate the -AddTagsFromFile option.
Your example raised another question for myself.
I do want to replace all values for the specific tags, but will it matter whether I use "-TAG1<TAG2" or "-TAG1+<TAG2"
Quote from: ScannerBoy on May 11, 2022, 08:54:17 PM
I do want to replace all values for the specific tags, but will it matter whether I use "-TAG1<TAG2" or "-TAG1+<TAG2"
Yes, it matters. See the last few lines in FAQ #17 (https://exiftool.org/faq.html#Q17).
Thank you for sticking with this.
I am afraid, I just realized that doing things via a response file - and that is the way I am trying to do this - would make a big difference.
What I am trying to do, is to add several names of the type "Doe, Joe"; "Doe, Jane"; "Doe, Kid" to the field
XMP-iptcExt: PersonInImage, replacing anything that might be there already.
Where I am stymied is with which options I do need and where they need to be split over separate lines and which bits need to be quoted - single or double quotes.
Quote from: ScannerBoy on May 12, 2022, 04:44:23 PM
I am afraid, I just realized that doing things via a response file
Response file? Do you mean an Args file via
-@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE) and maybe
-stay_open option (https://exiftool.org/exiftool_pod.html#stay_open-FLAG)?
QuoteWhat I am trying to do, is to add several names of the type "Doe, Joe"; "Doe, Jane"; "Doe, Kid" to the field
XMP-iptcExt: PersonInImage, replacing anything that might be there already.
Assuming Args file, then each entry on a separate line, no trailing spaces and no quotes (see FAQ #29 (https://exiftool.org/faq.html#Q29)). You have multiple ways to add the data (FAQ #17 (https://exiftool.org/faq.html#Q17)). The end result would be either
-PersonInImage=Doe, Joe
-PersonInImage=Doe, Jane
-PersonInImage=Doe, Kid
or using the
-sep option (https://exiftool.org/exiftool_pod.html#sep-STR--separator)
-sep
;
-PersonInImage=Doe, Joe;Doe, Jane;Doe, Kid
Normally,
-sep would use a comma, but you don't want that here because a comma is in your names, so I used the semicolon, which must be on a separate line than
-sep.
These commands will completely overwrite existing data.
Yes, it was via via -@ (Argfile) and your first solution did the trick perfectly
:) Thank you.