Author Topic: How to (Batch) embed XMP data — Sidecars into same-named JPEGs?  (Read 6230 times)

soulbot

  • Newbie
  • *
  • Posts: 3
Hello,

As this is my first post here, I hope I'm posting this in the proper forum. I was poking around already trying to find the answer to my question, before posting, but didn't come across anything quite as specific as what I'm hoping to achieve. I feel certain that the answer is out there though.

I'm about to embark on the process of migrating my entire Aperture catalog over to Lightroom. I'm doing some small test runs first to discover what kind of hiccups to expect. The Raw files involved aren't going to be an issue. I am going to use the Anon Arts Lightbox pluging for this. It will let me write sidecar files (only) for all the adjusted, keyworded Raws. Since most apps, including Lightroom, ignore XMP sidecars for JPEGs, it's now the JPEGs that become the concern.

Here's what I'm hoping to do with the JPEGs in the collection: export Masters from Aperture into a temporary holding zone. I'll choose to include IPTC4XMP sidecars to hang onto the keywords and ratings. But now I'll need to merge all the XMP data into the respective JPEG masters. Of course it makes sense to do this once, in a batch. I've already played around with the tagsfromfile command in a single file test. In that scenario I simply used the command—

exiftool -tagsfromfile my_photo.xmp my_photo.jpg

Works perfect for a writing the metadata from the .xmp file into the JPEG. Here then are my questions:

1.) How will the command differ when trying to run on many files? The JPEGs will all have a same-name XMP file, residing right beside them.

2.) Can the batch run on subfolders? Aperture is going to re-create my original project structure. The result will be a folder, with subfolders and the JPEGs will reside in the subfolders. Can the exiftool command somehow drill down into all these subfolders and still handle the mating up? Or will I need to break everything out into a single pool with all photos and all .xmp? How do I feed exiftool with directories?

3.) When embedding the metadata into the JPEGs can I (should I) only embed the rating and keywords? After all, that's all I'm looking to be able to use over in Lightroom anyway...

Any advice would be greatly appreciated.


Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13339
    • ExifTool Home Page
Re: How to (Batch) embed XMP data — Sidecars into same-named JPEGs?
« Reply #1 on: December 20, 2012, 08:05:53 PM »
Hi,

Yes, ExifTool can certainly do what you want.

Quote
exiftool -tagsfromfile my_photo.xmp my_photo.jpg

Works perfect for a writing the metadata from the .xmp file into the JPEG.

I would suggest a slight change if you want the XMP to stay as XMP (otherwise, same-named tags would be written to EXIF or IPTC instead of XMP):

exiftool -tagsfromfile my_photo.xmp -xmp:all my_photo.jpg

Quote
1.) How will the command differ when trying to run on many files? The JPEGs will all have a same-name XMP file, residing right beside them.

The only difference that you specify a directory name instead of a file name.  But in this case you should add a -ext option to process only the JPEG files:

exiftool -tagsfromfile my_photo.xmp -xmp:all -ext jpg my_directory

Quote
2.) Can the batch run on subfolders?

Just add the -r option to the above command and it will process files in the directory then recurse into sub-directories.

Quote
3.) When embedding the metadata into the JPEGs can I (should I) only embed the rating and keywords? After all, that's all I'm looking to be able to use over in Lightroom anyway...

You can easily do this by specifying -xmp:rating -xmp:subject instead of -xmp:all in the command.  It is up to you to decide how much (or little) of the metadata you want to copy.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

soulbot

  • Newbie
  • *
  • Posts: 3
Re: How to (Batch) embed XMP data — Sidecars into same-named JPEGs?
« Reply #2 on: December 20, 2012, 11:15:16 PM »
Hi Phil,

Thanks so much for the straightforward input. It works quite well!

However, the part I suppose I'm not following exactly is how to get the batch to use the 2nd .xmp for the 2nd jpeg, 3rd xmp. :: 3rd jpg, etc...

As it stands now, the metadata (rating, keywords) from, let's call it,  image_001.xmp is being embedded into image_001.jpg. Perfect! However since image_001.xmp is the sole .XMP file being called on by the command, only its metadata is being copied into ALL the jpegs. I'm hoping to have image_001.xmp metadata copy into image_001.jpg, but then

image_002.xmp metadata copy into image_002.jpg
image_003.xmp metadata copy into image_003.jpg
image_004.xmp metadata copy into image_004.jpg

...somehow I'm missing how to get this critical same-name alignment scenario to sync up and ripple throughout all the files properly.

For simplicity I'm using the simplest possible catalogs for experimenting. But I'll attach a screenshot showing my file structure. Pointing the command to the root of the folder, to "find" the JPEGs was simple enough. But by dropping a single .XMP file into the xmp slot in the terminal command, I'm marrying only it's metadata into ALL resulting jpegs. I'm sure I'm missing something simple.

Thanks again for your patience with a newbie!  :D
—Kevin


Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13339
    • ExifTool Home Page
Re: How to (Batch) embed XMP data — Sidecars into same-named JPEGs?
« Reply #3 on: December 21, 2012, 07:12:58 AM »
Hi Kevin,

Sorry, my mistake.  I wasn't paying close enough attention to the command.  To copy metadata from the same-named files it should have been:

exiftool -tagsfromfile %d%f.xmp -xmp:all -ext jpg -r my_directory

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

soulbot

  • Newbie
  • *
  • Posts: 3
Re: How to (Batch) embed XMP data — Sidecars into same-named JPEGs?
« Reply #4 on: December 21, 2012, 04:26:52 PM »
Awesome! This works perfectly.

Thanks so much for your guidance, Phil!

Happy Holidays