Author Topic: Preview Image Insertion  (Read 3033 times)

j

  • Jr. Member
  • **
  • Posts: 12
Preview Image Insertion
« 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.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Preview Image Insertion
« Reply #1 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

j

  • Jr. Member
  • **
  • Posts: 12
Re: Preview Image Insertion
« Reply #2 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.

Code: [Select]
[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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Preview Image Insertion
« Reply #3 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

j

  • Jr. Member
  • **
  • Posts: 12
Re: Preview Image Insertion
« Reply #4 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.