2010.02.11 21:56 "[Tiff] TIFF and IJG JPEG 8", by Bob Friesenhahn

2010.03.17 16:42 "Re: [Tiff] TIFFVStripSize overflow, JPEG decoding", by Jason Summers

Thank you Bob, Ed, for pointing out the limits on JPEG size.

In light of this fact I think the file may be more complex than I expected. The example I listed is actually on the small side and I am certain that typical examples cannot be contained within the limits you mention. Looking at tiffdump output for a larger file (listed below) I see unlabeled tags with array values. I'm guessing these are pointers into multiple separate JPEGs. I cannot be sure however because the manufacturer's documentation is still not available.

Supposing I have a pointer to a region of the file that contains an encoded JPEG, and the size of the region in bytes, is there a simple way to decode this region?

ImageWidth (256) LONG (4) 1<159744>
ImageLength (257) LONG (4) 1<109824>

RowsPerStrip (278) LONG (4) 1<109824>

So far as I know, JPEG image dimension fields are always 16-bit integers, for a maximum dimension of 65535 pixels. You have an alleged JPEG image that exceeds that, so something fishy is going on.

I think you're on the right track, that this is a nonstandard format, and that the JPEG strip actually contains multiple JPEG images. I think there's a reasonable chance that you could extract the images using libjpeg, by first seeking to their starting positions in the TIFF file. But finding those starting positions will require reverse engineering, or documentation.

Note that after decompression, the strip will be extremely large, over 4GB. Libtiff usually decompresses each strip in its entirety to memory, so even if libtiff supported the format, you might well run into a limitation somewhere. (For example, it obviously wouldn't work on a 32-bit system.)

--
Jason Summers