Thread

Posted on Thu May 15 10:45:57 2008 by wibbly
Can I insert missing thumbnails in JPGs?
A lot of software strips out embedded JPG thumbnails in JPG images. As a result, some image browsers either don't work or spend ages generating thumbnails on the fly. This is bad if they don't cache the thumbnails either. Will ExifTool tool insert missing jpg thumbnail metadata into jpg images? If so, can someone point me to where it's described how to do this, please?
Direct Responses: 7885 | Write a response
Posted on Thu May 15 13:56:26 2008 by exiftool in response to 7883
Re: Can I insert missing thumbnails in JPGs?
ExifTool can be used to insert a thumbnail, but you have to generate the thumbnail with some other utility. The command line looks like this:

exiftool "-thumbnailimage<=thumb.jpg" image.jpg

- Phil
Direct Responses: 7922 | Write a response
Posted on Fri May 23 01:01:22 2008 by schtroumpftitou in response to 7885
Re: Can I insert missing thumbnails in JPGs?
Hi, Your solution works great on the command line, but I would like to use it inside a perl script. I am using Exiftool 7.00 on ubuntu 8.04.
I have generated the thumbnail with ImageMagick:
convert 05_1821.jpg -thumbnail 160 exif_thumbnail.jpg

I have tried to write
$exifTool->SetNewValue("thumbnailimage", "exif_thumbnail.jpg");,
but it doesn't work, I got an error: [minor] Not a valid image for Composite:ThumbnailImage
I have also tried to read the file first:
open(DAT, $data_file) || die("Could not open file!"); @raw_data=<DAT>; $exifTool->SetNewValue("thumbnailimage", @raw_data); close(DAT);
but i also have an error: Odd number of elements in hash assignment at /usr/share/perl5/Image/ExifTool/Writer.pl line 177
If someone can help me on this problem it would be great. Thanks.
Ithier
Direct Responses: 7923 | Write a response
Posted on Fri May 23 14:16:26 2008 by exiftool in response to 7922
Re: Can I insert missing thumbnails in JPGs?
Close, but you need to pass the image as a scalar, not an array. I think this post may help by showing you one way that this can be done.

- Phil
Direct Responses: 7925 | Write a response
Posted on Sat May 24 19:34:35 2008 by schtroumpftitou in response to 7923
Re: Can I insert missing thumbnails in JPGs?
Thanks, it works great.
Ithier
Write a response