ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:25 AM

Title: jpeg previews?
Post by: Archive on May 12, 2010, 08:54:25 AM
[Originally posted by dh on 2008-09-24 02:50:53-07]

Hi all.... I'm a little confused by all the jpeg preview voodoo. Seemingly, one can embed jpeg previews larger than the 64k allowed in the exif header. Something about pointers in the header to the actual preview data at the end of the file. I have been playing a bit with exiftool and am not making great progress and was wondering if any here could offer some poiners. I'm using the windows exe. Also, if the preview data is written to the end of the jpeg file why does it have to be base64?

Any help is greatly appreciated!
dh
Title: Re: jpeg previews?
Post by: Archive on May 12, 2010, 08:54:25 AM
[Originally posted by exiftool on 2008-09-24 11:10:54-07]

The previews aren't base64 -- they are straight binary.  The
only base64-encoded image is the XMP thumbnail, but this
isn't very common.  The PreviewImage voodoo is manufacturer
specific in most cases since the pointer is located in the
proprietary makernote data, and ExifTool will only append a
PreviewImage trailer if it is supported by the embedded
makernotes.

There are other techniques for adding a large preview to
a JPEG:  1) The AFCP trailer preview, which is an open standard
but not very common, and 2) the MIE trailer, which is exiftool
specific.  Note that basically nothing except exiftool will be able
to read a preview image in these formats, and most image
editors will destroy such a preview when they rewrite the image.

Also, ExifTool will not add these types of trailers, but it is easy
to add them yourself once you have created them.  Below
is an example of how to add a large preview image in a MIE
trailer:

Code:
exiftool trailer.mie "-previewimage<=preview.jpg" -trailersignature=1
 type trailer.mie >> image.jpg

The first command above creates a MIE file containing the large
preview, and adds a trailer signature so the MIE file can be used
as a JPEG trailer.  The second command adds the MIE trailer to
a JPEG image (with any luck -- I'm not a Windows expert, but I
think the "type" command may do this.  In Unix, the "cat"
command is used).

I hope this helps.

- Phil