2005.05.27 07:46 "[Tiff] how to convert a JPEG-IN-TIFF file to jpeg file without decomress & compress", by Kelvin Zhong

2005.05.27 07:46 "[Tiff] how to convert a JPEG-IN-TIFF file to jpeg file without decomress & compress", by Kelvin Zhong

Hi,

Recently i hover on such things .but i was so new to JPEG-FILE format...: i have done following things:

Assumption:
 1.JPEG-IN-TIFF was writed as a single strip.

use tiffdump to see the example image for detailed info:

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 497358 (0x796ce) next 0 (0)
ImageWidth (256) SHORT (3) 1 <2048>
ImageLength (257) SHORT (3) 1 <1536>
BitsPerSample (258) SHORT (3) 3 <8 8 8>
Compression (259) SHORT (3) 1 <7>
Photometric (262) SHORT (3) 1 <6>
StripOffsets (273) LONG (4) 1 <1725>
Orientation (274) SHORT (3) 1 <1>
SamplesPerPixel (277) SHORT (3) 1 <3>
StripByteCounts (279) LONG (4) 1 <495633>
XResolution (282) RATIONAL (5) 1 <300>
YResolution (283) RATIONAL (5) 1 <300>
PlanarConfig (284) SHORT (3) 1 <1>
ResolutionUnit (296) SHORT (3) 1 <2>
347 (0x15b) UNDEFINED (7) 574 <0xff 0xd8 0xff 0xdb 00 0x43 00 0x8 0x6 0x6 0x7 0x6 0x5 0x8 0x7 0x7 0x7 0x9 0x9 0x8 0xa 0xc 0x14 0xd ...>
YCbCrSubsampling (530) SHORT (3) 2 <1 1>
ReferenceBlackWhite (532) RATIONAL (5) 6 <0 255 128 255 128 255>

I use these 2 tags( StripOffsets & StripByteCounts ) to extract
the jpeg-data from the tiff file.
and save it as a JPG file.(but it failed to open).
I opened this JPG file with a HEX editor.
and compared it to normal JPG file.

and i found it seemed to loss some infomations(something like
FILE header ?....,such like BITMAPFILEHEADER to BMP files...)

do anyone here have some experience on this area?
(i am so new with JPEG-FILE format ,nearly know nothing about it).
Similiar codes would be good.

thanks in advance,

yourpattern@126.com
Kelvin zhong