ExifTool Forum

ExifTool => Newbies => Topic started by: Scott on August 20, 2018, 07:46:20 PM

Title: Batch extract data from jpg to xmp
Post by: Scott on August 20, 2018, 07:46:20 PM
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.
Title: Re: Batch extract data from jpg to xmp
Post by: Scott on August 20, 2018, 08:29:25 PM
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.
Title: Re: Batch extract data from jpg to xmp
Post by: StarGeek on August 20, 2018, 09:35:07 PM
Also check out Metadata Sidecar Files example 11 (https://exiftool.org/metafiles.html#EX11).

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'.
Title: Re: Batch extract data from jpg to xmp
Post by: Scott on August 21, 2018, 08:50:43 PM
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.
Title: Re: Batch extract data from jpg to xmp
Post by: StarGeek on August 21, 2018, 09:02:44 PM
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.
Title: Re: Batch extract data from jpg to xmp
Post by: Scott on August 22, 2018, 06:30:14 PM
Thanks so much!