Jpeg from Tiff (jpeg-compressed)

user393679 picture user393679 · Apr 20, 2011 · Viewed 12.8k times · Source

How can i extract image from JPEG-compressed TIFF file ?

I've read bytes according to StripOffests and StripBytesCount fields, but i couldn't load an image from them.

Answer

BitBank picture BitBank · Apr 21, 2011

Old style TIFF-JPEG (compression type 6) basically stuffed a normal JFIF file inside of a TIFF wrapper. The newer style TIFF-JPEG (compression type 7) allows the JPEG table data (Huffman, quantization), to be stored in a separate tag (0x015B JPEGTables). This allows you to put strips of JPEG data with SOI/EOI markers in the file without having to repeat the Huffman and Quantization tables. This is probably what you're seeing with your file. The individual strips begin with the sequence FFD8, but are missing the Huffman and quantization tables. This is the way that Photoshop products usually write the files.