ExifTool Forum

ExifTool => Newbies => Topic started by: j on December 26, 2011, 11:03:56 PM

Title: Preview Image Insertion
Post by: j on December 26, 2011, 11:03:56 PM
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.
Title: Re: Preview Image Insertion
Post by: Phil Harvey on December 27, 2011, 07:46:56 AM
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
Title: Re: Preview Image Insertion
Post by: j on December 27, 2011, 08:15:00 AM
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
Title: Re: Preview Image Insertion
Post by: Phil Harvey on December 27, 2011, 11:38:49 AM
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
Title: Re: Preview Image Insertion
Post by: j on December 27, 2011, 04:36:36 PM
Ah, right.

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