Tranfer location from XMP sidecar file to Jpeg EXIF

Started by Taniwha, August 06, 2019, 11:28:25 AM

Previous topic - Next topic

Taniwha

The problem:
I have some 35000 jpeg photos with corresponding XMP sidecar files with additional information so that jpeg originals are untouched.
I have further collections of modified copies of the originals. For these (jpeg) copies I want to copy the location information from the XMP sidecar files to the Geo Tags within the EXIF information.

My attempts so far:
To transfer the information from the sidecars to the jpegs, I found the following infos under item 10. at
https://exiftool.org/metafiles.html

Restore XMP as a block from an XMP sidecar file to a JPG image:
(same effect as above except that any non-writable XMP tags would be copied by this command, and the 2 kB of padding recommended by the XMP specification is not added when copying as a block)

exiftool -tagsfromfile SRC.xmp -xmp DST.jpg
or equivalently
exiftool "-xmp<=SRC.xmp" DST.jpg

What happened:
The lines appear to be not equivalent.

The first option gave me the following reply:
Warning: No writable tags set from SRC.XMP
    0 image files updated
    1 image files unchanged


The second option seemed to have worked, and the modified jpeg was about 1kB bigger.
However, trying to use any of the random programs to show the location of the photo failed.
If I use Exiftool, I can see the geo location somewhere in its output list:

XMP Toolkit                     : Image::ExifTool 11.27
Location                        : InterCityHotel Berlin-Brandenburg Airport
GPS Altitude Ref                : Above Sea Level
GPS Img Direction               : 195.113995485327
GPS Img Direction Ref           : True North
GPS Latitude                    : 52 deg 23' 17.25" N
GPS Longitude                   : 13 deg 31' 13.50" E
GPS Map Datum                   : WGS-84
GPS Version ID                  : 2.2.0.0
City                            : Sch├Ânefeld
Country                         : Deutschland
State                           : Brandenburg


I wonder if the beginning line "XMP Toolkit" is causing the trouble for "normal viewers".
Further, I am only intersted in copying the GPS information, not the rest of the XMP file entries.
All my XMP sidecar files were generated with the Java Script application "GeoTag".

Has anybody ideas and suggestions how to modify the command line (no matter if for single images or batch processing)...

StarGeek

The first command works with an updated version of exiftool, at least version 11.45 or greater (the change happened somewhere between 11.40 and 11.45).

Both of those command copy data from the sidecar file to XMP locations in the file.  They don't copy data into the EXIF block which appears to be where your programs seem to be checking.

What you probably want to do is basically the reverse of Sidecar Example #5, copy from the XMP sidecar to the EXIF block.  This is a complicated operation, but there is an Args file available to facilitate the operation, called xmp2exif.args.  You can either download the main distribution package (Download Version 11.60 link on the main page) and extract it from there or grab the xmp2exif.args file from Github.

Drop xmp2exif.args into the same directory as exiftool and then your command would be
exiftool -TagsFromFile  SRC.xmp -@ xmp2exif.args DST.jpg

If that works for you, then you could batch import the data with
exiftool -TagsFromFile %d%f.xmp -@ xmp2exif.args -ext jpg /path/to/jpegs/

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Taniwha

Worked straight away, and with -P, it even preserved the timestamp.
Found references to the args file before, but in a different context, so didn't follow up.
Will try batches next weekend.
Thanks a lot, Stargeek!!