2005.05.28 17:21 "Re: [Tiff] how to convert a JPEG-IN-TIFF file to jpeg file without decomress & compress", by Joris Van Damme
1.JPEG-IN-TIFF was writed as a single strip.
That is indeed a necessary assumption. Every single strip/tile in a JPEG-in-TIFF is a seperate, valid JPEG stream. So the only way it's going to succeed is with single strip(/tile) images.
Even though the JPEG stream is valid, it may not be sufficient, since it may miss some information that is encoded in the JpegTables tag, or in the Photometric tag.
- JpegTables: For a recent explanation, see http://www.asmail.be/msg0054784488.html. This tag is possible and legit, even with a single strip JPEG-in-TIFF (even though that is somewhat braindead). If it's there, you'll have to merge the tables into the strip JPEG stream.
- Photometric: It is common, but actually not very good practice, to include JFIF markers or APP14 Adobe markers and such in the JPEG stream inside TIFF. But it is not necessary, and it is not recommendable, and there are proper JPEG-in-TIFF files that ommit this information in the JPEG stream. You'll have to be prepared for that, and add it.
The best scheme, is probably to 'filter'. Scan through the JPEG stream, gather what you need, and together with info in other places like the JpegTables tag, build your output JPEG stream from that, marker by marker. This scheme is recently explained in http://www.asmail.be/msg0054649067.html, even if that was in the context of the inverse direction (JPEG to JPEG-in-TIFF).
and i found it seemed to loss some infomations(something like
FILE header ?....,such like BITMAPFILEHEADER to BMP files...)
On what did you base that conclusion? JPEG doesn't have a very elaborate 'file header'. It's a stream of markers. Each marker starts with a 255 byte, followed by a marker identifier byte. The very first marker in there should be the SOI marker, which means the stream should start with a 255 byte, followed by a 216 byte, from the top of my head.
Joris Van Damme
Download your free TIFF tag viewer for windows here: