Hello all,
I'm trying to write thumbnails to a set of images and using the filename as part of the thumbnail path but I'm not having much joy.
I'm using a batch file on Windows, with the images in a subdirectory and the thumbnails also in a subdirectory. The thumbnails have the same name as the images.
The following fails with the error "Error opening file thumbnails/$filename".
exiftool "-ThumbnailImage<=thumbnails/$filename" "photos/*.jpg"
Testing with single image, and hardcoding the file names, as below, works OK, so it doesn't seem to a path issue.
exiftool "-ThumbnailImage<=thumbnails/aaa.jpg" "photos/aaa.jpg"
Any suggestions for what I'm doing wrong?
Thanks,
Stephen
Windows 10
ExifTool 11.2.9.0
The answer lies in the error response. Exiftool is trying to open thumbnails/$filename, not thumbnails/aaa.jpg. That tells you that it's not reading $filename as a tag, but as static string.
If you read the docs for the -TAG<=DATFILE option (https://exiftool.org/exiftool_pod.html#TAG-DATFILE-or--TAG-FMT), you'll see that it gives the %code variables for filename, directory, etc, and doesn't mention using tags at all.
Try
exiftool "-ThumbnailImage<=thumbnails/%F" "photos/*.jpg"
I have to confess, I completely overlooked the -TAG<=DATFILE option.
It's working a treat (I just had to escape the %, as it's a Windows batch file).
Thanks.