Status: Read
Received: from [207.113.13.68] by phillip.cerious.com (NTMail 3.03.0017/7.aaxh) with ESMTP id pcrews for <pcrews@cerious.com>; Thu, 12 Aug 1999 10:30:26 -0400
Received: from localhost (bin@localhost)
	by gate7.olympiakos.com (8.8.7/8.8.7) with SMTP id KAA16119;
	Thu, 12 Aug 1999 10:09:21 -0400
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Thu, 12 Aug 1999 09:59:44 -0400
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.8.7/8.8.7) id JAA16035
	for tiff-outgoing; Thu, 12 Aug 1999 09:59:43 -0400
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2])
	by gate7.olympiakos.com (8.8.7/8.8.7) with ESMTP id JAA16029
	for <tiff@olympiakos.com>; Thu, 12 Aug 1999 09:59:41 -0400
Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1])
	by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id JAA17991;
	Thu, 12 Aug 1999 09:58:59 -0400 (EDT)
To: James McMullen <james@iimap.com>
cc: tiff@olympiakos.com
Subject: Re: TIFF to JPEG file - how? 
In-reply-to: Your message of Wed, 11 Aug 1999 15:01:48 -0700 
             <37B1F2CB.481E3394@iiMap.com> 
Date: Thu, 12 Aug 1999 09:58:59 -0400
Message-ID: <17989.934466339@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
Sender: owner-tiff@olympiakos.com

James McMullen <james@iiMap.com> writes:
> I want to write a JPEG file from a JPEG'd TIFF image without
> decompressing and recompressing.

> If so, how? I'm trying to adapt code in tiffsplit.c or tiffcp.c, but I'm
> unclear on how to write the raw data in a JPEG conventional way. If I
> adapt the code in cjpeg.c (from the JPEG distribution) I'm unclear how
> to splice in the TIFF strip-oriented code (i.e. convert the raw TIFF
> data from TIFFReadRawStrip() to the JSAMPIMAGE sample expected by
> jpeg_write_raw_data()).

If you did such a thing then you wouldn't have produced a lossless copy;
jpeg_write_raw_data() only avoids colorspace conversion & resampling,
not DCT.

For single-strip images you really don't have to do anything except
extract the raw contents of the strip and write it out to a file.
I think you can persuade libtiff to give you back the physical contents
of a strip without passing it through any decompressor, but I forget
how.

Multi-strip images would be considerably harder.  If they're all
compressed at the same quality setting then in theory you could do it
(you'd need a souped-up version of jpegtran); but the spec allows for
varying compression settings between strips/tiles, which cannot be
losslessly converted to a single 10918-1 JPEG datastream...

			regards, tom lane
			organizer, Independent JPEG Group
