Return-Path: <tiff-bounces@remotesensing.org>
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx009.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j4SHLrjf015296
        for <joris.at.lebbeke@skynet.be>; Sat, 28 May 2005 19:21:56 +0200
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 478ED25B18B3; Sat, 28 May 2005 13:21:25 -0400 (EDT)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx010.isp.belgacom.be (outmx010.isp.belgacom.be
	[195.238.3.233])
	by xserve.flids.com (Postfix) with ESMTP id CEFB925B18A1
	for <tiff@remotesensing.org>; Sat, 28 May 2005 13:21:15 -0400 (EDT)
Received: from outmx010.isp.belgacom.be (localhost [127.0.0.1])
	by outmx010.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id j4SHL2HD028818
	for <tiff@remotesensing.org>; Sat, 28 May 2005 19:21:02 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (154-137.246.81.adsl.skynet.be [81.246.137.154])
	by outmx010.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id j4SHKwCF028769; Sat, 28 May 2005 19:20:59 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <002601c563a9$c6aee260$9a89f651@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "yourpattern" <yourpattern@126.com>, "tiff" <tiff@remotesensing.org>
References: <4296D046.0001A5.25145@m56.126.com>
Subject: Re: [Tiff] how to convert a JPEG-IN-TIFF file to jpeg file without
	decomress & compress 
Date: Sat, 28 May 2005 19:21:59 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="gb2312"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Cc: 
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 000000000023ceae.000002c9
X-MSP-STORE: Sat, 28 May 2005 19:22:02 +0200
Status:   

Kelvin,

> Assumption:
>  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
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html

_______________________________________________
Tiff mailing list: Tiff@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
