2005.12.03 07:15 "[Tiff] Attempting to parse EXIF data (in a JPEG) with libtiff", by Joshua Muskovitz

2005.12.03 07:15 "[Tiff] Attempting to parse EXIF data (in a JPEG) with libtiff", by Joshua Muskovitz

Hi all,

I'm trying to implement an JPEG/EXIF parser using libtiff. Separately, I am able to extract the EXIF block from the source jpeg image, and I can see that it has the proper "II" preamble for TIFF. I can also see the textual EXIF data within the block.

When I try to parse the data with libtiff, I fail in this logic in TIFFReadDirectory, called from TIFFClientOpen:

    if (!TIFFFieldSet(tif, FIELD_IMAGEDIMENSIONS)) {
        MissingRequired(tif, "ImageLength");
        goto bad;
    }

which fails, and then I'm dumped out of the file and unable to parse it. Now valid EXIF blocks supposedly have no image data in the 0th IFD, and I suspect this is the reason it chokes.

As a reality check, I *am* able to parse actual TIFF image files using my libtiff wrappers, so I have confidence that that isn't the problem.

Am I nuts to be attempting this in the first place? Is there something obvious I'm missing here?

Joshua Muskovitz
Lead Software Engineer
Preclick Corporation
josh@preclick.com

www.preclick.com