Author Topic: Problem Adding Keywords to JPG / XMP files ...  (Read 265 times)

JRHowell

  • Newbie
  • *
  • Posts: 4
Problem Adding Keywords to JPG / XMP files ...
« on: February 01, 2020, 11:35:42 AM »
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

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #1 on: February 01, 2020, 11:39:17 AM »
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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

JRHowell

  • Newbie
  • *
  • Posts: 4
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #2 on: February 01, 2020, 12:21:07 PM »
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

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #3 on: February 01, 2020, 12:55:05 PM »
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
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

JRHowell

  • Newbie
  • *
  • Posts: 4
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #4 on: February 01, 2020, 01:03:20 PM »
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

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #5 on: February 01, 2020, 01:20:26 PM »
Works correctly here.
Code: [Select]
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

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

The command will not complete

This also works correctly here
Code: [Select]
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

Quote
I'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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

JRHowell

  • Newbie
  • *
  • Posts: 4
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #6 on: February 01, 2020, 01:47:03 PM »
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

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3794
Re: Problem Adding Keywords to JPG / XMP files ...
« Reply #7 on: February 01, 2020, 01:52: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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.