ExifTool Forum

ExifTool => Newbies => Topic started by: brockgs on September 27, 2021, 03:49:38 PM

Title: Save preview image of .arw to .jpg with filename using XMP:Description field
Post by: brockgs on September 27, 2021, 03:49:38 PM
I'd like to extract the PreviewImage from all .ARW files in a directory, save them as .JPG files and append the 'Description' from the source file's XMP file to the output filename.

Here's a non-working command that tries to express what I want to do:
exiftool -b -PreviewImage -w _${XMP:Description}.jpg -ext ARW .

So given the files photo1.ARW and photo1.XMP, when I run the command I would get the file photo1_MyPhotoDescription.jpg if "MyPhotoDescription" was the value of the Description field in the file photo1.XMP

Thoughts?

Thank you very much. I have been reading through the forums, checking out examples I can find, and haven't found anything quite like this. I'm sure it's very possible, I'm just having difficulty locating information about it.
Title: Re: Save preview image of .arw to .jpg with filename using XMP:Description field
Post by: StarGeek on September 27, 2021, 06:10:31 PM
You can't use tags as part of the name from the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).  You'll have to run a second command using -TagsFromFile option (https://exiftool.org/exiftool_pod.html#tagsFromFile-SRCFILE-or-FMT) to copy the Description to the new files Filename.

So extract with
exiftool -b -PreviewImage -w %f.jpg -ext ARW .

Then rename with
exiftool -TagsFromFile %f.arw "-Filename<_${XMP:Description}.jpg" -ext jpg .

Though test it out first using Testname instead of Filename, as I haven't tested it to see if it works.