Batch extract data from jpg to xmp

Started by Scott, August 20, 2018, 07:46:20 PM

Previous topic - Next topic

Scott

I'm able to get a single file to work, but I cannot figure out how to do this as a batch command. 

This works for a single file and seems to give me the output I want:
exiftool -tagsFromFile P1030019.JPG -Keywords -ImageDescription -GPSLatitude -GPSLongitude P1030019.xmp

I've tried:
exiftool -ext JPG -tagsFromFile @ -Keywords -ImageDescription -GPSLatitude -GPSLongitude -srcfile %d%f.xmp
exiftool -tagsFromFile @ -Keywords -ImageDescription -GPSLatitude -GPSLongitude -ext JPG %d%f.xmp
exiftool -tagsFromFile %d%f.jpg -Keywords -ImageDescription -GPSLatitude -GPSLongitude -ext JPG %d%f.xmp
exiftool -ext JPG -tagsFromFile %d%f.jpg -Keywords -ImageDescription -GPSLatitude -GPSLongitude %d%f.xmp

None of these versions work.  I get an error: File not found - %d%f.xmp

How can I do this batch wise?  Thanks.

I'm doing this on a Mac.

Scott

To answer my own question, here is the command that works:


exiftool -ext JPG -tagsFromFile @ -Keywords -ImageDescription -GPSLatitude -GPSLongitude -srcfile %d%f.xmp DIR

Where DIR is the directory with the files in it.  It doesn't just work if the command is executed in the directory, you must specify the directory.

StarGeek

Also check out Metadata Sidecar Files example 11.

One thing to take note of here is that you may not be getting the data you want where you want it.  The xmp file can only hold XMP data and your tags are probably going to be copied to XMP-pdf:Keywords and XMP-tiff:ImageDescription, as they are originally IPTC and EXIF data type, respectively.  Especially since XMP-pdf:Keywords is a string tag, not a list tag. These may not be where you want the data to be.  The standard placement would be Subject and Description.  If they don't exist in your jpg, you would need to do a tag copy, e.g. '-Subject<Keywords' '-Description<ImageDescription'.
* 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).

Scott

Quote from: StarGeek on August 20, 2018, 09:35:07 PM
The standard placement would be Subject and Description.  If they don't exist in your jpg, you would need to do a tag copy, e.g. '-Subject<Keywords' '-Description<ImageDescription'.

Thanks, it turns out that even though I'm writing the keywords to the .xmp file, the application I'm using (iView) is not picking them up (it does get the description). 

I tried to revise the command to:
exiftool -ext JPG -tagsFromFile @ -Subject<Keywords -ImageDescription -GPSLatitude -GPSLongitude -srcfile %d%f.xmp

but that gives an error of No such file or directory (using terminal on a Mac). 

An xmp file created by iView stores keywords in this way:

         <dc:subject>
            <rdf:Bag>
               <rdf:li>Sarah</rdf:li>
            </rdf:Bag>
         </dc:subject>

So I think I do need to covert the keywords to subject, but I'm not sure how.

StarGeek

You forgot the quotes as in my example.  Single quotes since you're on a Mac.  This is to prevent the terminal from treating the less than sign as a file redirection.
* 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).