Preview Image Insertion

Started by j, December 26, 2011, 11:03:56 PM

Previous topic - Next topic

j

I thought I had this figured out, but maybe not.

I rotated a test image, but then the embedded preview image (and thumbnail image) remains unrotated.  It would be nice to rotate them, too.  so I extracted the preview it, and rotated it as well, but if I go to reinsert it, I get an error:

Warning: [minor] Not a valid image for File:PreviewImage

I'm assuming that I could override that with the ignore minor error switch, but I'd like to figure out what ExifTool thinks is wrong with it.

Anyone have any insight, or know how to get ExifTool to give more information?  I tried telling it to be more verbose, but that didn't produce anything usable.

Thanks.

Phil Harvey

You get this error if you are trying to write something that isn't a JPEG image.

Perhaps there is something wrong with your command.  What was the command you used?

- 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 ($).

j

Here are the commands I use:


exiftool -previewimage -b -w %%f_preview.jpg file.jpg
jpegtran -rotate 270 file_preview.jpg file_preview_new.jpg
exiftool -previewimage=file_preview_new.jpg file.jpg


I tried exiftool with -v5 capturing the output in a file.  It sure didn't tell me much.  Here's a portion of that output.  The image came from a Nikon.


[minor] Not a valid image for Composite:PreviewImage
Writing MIE-Preview:PreviewImage
Writing FotoStation:PreviewImage if tag exists
Not a valid image for Leica:PreviewImage
[minor] Not a valid image for Casio:PreviewImage
Error converting value for Sony:PreviewImage (ValueConvInv)
[minor] Not a valid image for Olympus:PreviewImage
[minor] Not a valid image for Minolta:PreviewImage
[minor] Not a valid image for File:PreviewImage

Phil Harvey

Yes, there's the problem.  Your command tries to set the preview image to the string "file_preview_new.jpg".  You must use <= to set the value of a tag from the contents of a file:

exiftool "-previewimage<=file_preview_new.jpg" file.jpg

- 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 ($).

j

Ah, right.

I even saw that in the docs in reference to tags expecting lists.  Didn't put two and two together.  Thanks.