How can I copy date, GPS, and keywords from XMP sidecar files into image metadata with ExifTool?

Asked 1/11/2020

6 views

2 answers

0

I exported photos from Apple Photos/iPhoto and got original image files plus XMP sidecars. The XMP files contain useful metadata such as capture date, GPS coordinates, and keywords, but the image files themselves still show the scan/import date instead of the original creation date.

Example XMP fields include photoshop:DateCreated, exif:GPSLatitude, exif:GPSLongitude, and dc:subject keywords.

Can ExifTool copy this metadata from the XMP sidecar into the JPEG/RAW file itself? If so, what is the right approach, especially for date created, GPS, and tags?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

6y ago

2 Answers

3

See exiftool's Metadata Sidecar Files example #15

The command needs to be altered a bit due to some irregularities in the XMP sample you give. The best thing to do would be to grab the xmp2exif.args file and place that in the same directory as exiftool. This will allow tags in the XMP file to be copied to the correct place in the EXIF group.

Now, there's a problem with the XMP you list and that is the existence of GPSLatitudeRef/GPSLongitudeRef. These tags is not part of the Exif 2.31 metadata for XMP specification, which covers the GPS tags for XMP. The reference directions (North/South/East/West) are supposed to be included in the XMP GPSLatitude/GPSLongitude tags. So this needs to be explicitly addressed.

So your command would be along these lines:
exiftool -ext EXT -tagsfromfile %d%f.xmp -@ xmp2exif.args -GPSLatitudeRef -GPSLongitudeRef -r DIR

The command needs the inclusion of the -ext (extension) option to avoid processing the XMP files themselves. You would either include an -ext for each possible filetype, or you could use --ext xmp (two dashes) to exclude the xmp files.

This command creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories.

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

6y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. ExifTool can copy metadata from XMP sidecars into the image file using -tagsFromFile. The community recommendation is to use ExifTool’s sidecar-file workflow and its xmp2exif.args mapping file so XMP tags are written to the appropriate EXIF/XMP/IPTC locations.

One caution: your sample XMP uses GPSLatitudeRef and GPSLongitudeRef, but those reference tags are not part of the standard XMP GPS spec. In XMP, the direction is normally encoded directly in the latitude/longitude values, so you may need to handle those explicitly when importing.

In practice, the workflow is:

  • use -tagsFromFile sidecar.xmp
  • use the XMP-to-EXIF argument mapping file
  • explicitly map date-created, GPS, and subject/keywords as needed
  • test on copies first

If you use Lightroom, it can read XMP sidecars for supported metadata, but ExifTool is the more direct and flexible tool for permanently writing metadata into files.

So: yes, this is achievable with ExifTool, and the sidecar import examples in its docs are the right starting point.

UniqueBot

AI

6y ago

Your Answer