Problem Adding Keywords to JPG / XMP files ...

Started by JRHowell, February 01, 2020, 11:35:42 AM

Previous topic - Next topic

JRHowell

I'm a newbie trying to figure out how to use EXIFTool to add keywords to my photos. I tried the following, but it doesn't seem to add the keywords. Can anyone point me to some remedial information to get me going?

JPEG Example:
exiftool -xmp -b JR20190605-0009.jpg
to see the keywords in this file.

I can find the following:
<dc:subject>
    <rdf:Bag>
     <rdf:li>Running</rdf:li>
     <rdf:li>Sports</rdf:li>
    </rdf:Bag>
   </dc:subject>

So ... keywords "Running" and "Sports" are what I see in Lightroom. Great.

Now I want to add a couple Bib Numbers as Keywords. So ... I do the following command which I would think will add the Keywords "1763" "1598" and "1680" if they don't already exist.
exiftool -sep ", " -iptc:Keywords-="1763,1598,1680" -iptc:Keywords+="1763,1598,1680" JR20190605-0009.jpg

This command creates a backup file "JR20190605-0009.jpg_original" and another file "JR20190605-0009.jpg"

However ... if I look into the file created with
exiftool -xmp -b JR20190605-0009.jpg

I can't seem to find the new keywords.

Any ideas?

Thank you so much.

JR


StarGeek

Keywords is an IPTC (IIM/Legacy) tag and will not show up in the XMP.  Change your command to use the XMP version, Subject, and you should be able to see it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JRHowell

Well ... I tried the following command replacing "Keywords" with "Subject" ... but the command doesn't complete.

exiftool -sep "," -iptc:Subject-="1763,1598,1680" -iptc:Subject+="1763,1598,1680" JR20190605-0009.jpg


I'm using EXIFTool 11.85 on a Mac ... OSX 10.14.6

StarGeek

Just use Subject.  You want to use XMP tags but you are labeling them as IPTC. 
exiftool -sep "," -Subject-="1763,1598,1680" -Subject+="1763,1598,1680" JR20190605-0009.jpg
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JRHowell

I couldn't seem to get -Subject to work. The command wouldn't complete.

I did make some progress though. I figured out that "Subject" was part of "XMP-dc" and not "iptc"

So ... THIS command WORKS for me to add Keywords!
exiftool -sep "," -XMP-dc:Subject+="1763,1598,1680" JR20190605-0009.jpg

However, it appears to blindly add these keywords ... even if they already exist.
The good news is that Lightroom seems to accommodate that ok and will sort and eliminate duplicate keywords on import.

Still ... I would think the -= would remove these before adding? I must be missing something.

If I do
exiftool -sep "," -XMP-dc:Subject-="1763,1598,1680" JR20190605-0009.jpg

The command will not complete ... which is why:
exiftool -sep "," -XMP-dc:Subject-="1763,1598,1680" -XMP-dc:Subject+="1763,1598,1680" JR20190605-0009.jpg
won't work.

I'm sure there is a better way to do this to add keywords only of they don't exist already.

Any ideas??

Thanks

JR


StarGeek

Works correctly here.
C:\>exiftool -g1 -a -s -Subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Keyword1, 1763, 1680, Keyword2

C:\>exiftool -sep "," -Subject-="1763,1598,1680" -Subject+="1763,1598,1680" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -Subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Keyword1, 1763, 1598, 1680, Keyword2


Quote from: JRHowell on February 01, 2020, 01:03:20 PM
If I do
exiftool -sep "," -XMP-dc:Subject-="1763,1598,1680" JR20190605-0009.jpg

The command will not complete

This also works correctly here
C:\>exiftool -g1 -a -s -subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Keyword1, 1763, 1680, Keyword2

C:\>exiftool -sep "," -XMP-dc:Subject-="1763,1598,1680" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -subject y:\!temp\Test4.jpg
---- XMP-dc ----
Subject                         : Keyword1, Keyword2


QuoteI'm sure there is a better way to do this to add keywords only of they don't exist already.

Something is going wrong on your end.  What OS are you using?  If on Windows, make sure to use CMD and not PowerShell.  PS sometimes does weird things with exiftool.  Make sure you're not copy/pasting commands from a word processor/Google docs.  They will "help" you by changing some of the characters, making them unsuitable for saving command lines.

See FAQ #17 for more details.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

JRHowell

You are correct, there was something wrong on my end.

I'm using a Mac and was creating my commands in Notes ... well ... "occasionally" Notes converted my double quotes to curly quotes for me ... :-(
This one was weird ...

So ... now I'm editing commands in BBEdit and it works like a champ!

Thank you so much for your help!

Off and running with EXIFTool! It's great!


StarGeek

Quote from: JRHowell on February 01, 2020, 01:47:03 PM
I'm using a Mac and was creating my commands in Notes ... well ... "occasionally" Notes converted my double quotes to curly quotes for me

If you find it to be more of hindrance than a help, see this SuperUser post.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).