any way to rewrite tagnames for %t option of -W when extracting thumbs?

Started by aritchie, March 15, 2023, 07:47:42 PM

Previous topic - Next topic

aritchie

I'm extracting full-res browse images and thumb images to use in kml generated with a .fmt file, and I would like to only iterate through the images once with exiftool, and replace the original tagnames specified by %t with an alternative. Is it possible to issue a single exiftool command to rename the %t so that 'PreviewImage' is 'thumb' and JpgFromRaw' is 'browse'? Happy to use perl or regex magicks if I can but couldn't figure out where to put them. I tried creating aliases in a .config file, but %t still wrote the tagnames and not the aliases.

Right now I can do this:

#extract thumbs to thumb dir and previews to previews dir w two exif commands:
exiftool -b -PreviewImage -W finding_aids/thumb/%f_thumb%-c.%s -ext nef NEF
exiftool -b -JpgFromRaw -W finding_aids/browse/%f_browse%-c.%s -ext nef NEF

or this:

#extract thumb and full size previews by tagnames w one exiftool cmd, then rename:
exiftool -b -PreviewImage -JpgFromRaw -W finding_aids/%t/%f_%t%-c.%s -ext nef NEF
mkdir browse
mkdir thumb
find . -type f -exec rename 's/JpgFromRaw/browse/g' {} \;
find . -type f -exec rename 's/PreviewImage/thumb/g' {} \;
rmdir PreviewImage
rmdir JpgFromRaw

Maybe #1 above is my best bet? I was just hoping to avoid two iterations through all the files (hundreds of thousands of them).

Phil Harvey

Unfortunately I can't see a single-pass solution for this.

I think option 2 is best: A single pass with exiftool then rename all the files, because the renaming should be faster.

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

aritchie

I was hoping there might be a fancy way to pipe or redirect but couldn't see a way to do it with my limited piping and redirecting skills. Thanks for the quick reply!