Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx016.isp.belgacom.be (inmx016.isp.belgacom.be [195.238.2.219])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j082ZboQ025470
        for <joris.at.lebbeke@skynet.be>; Sat, 8 Jan 2005 03:35:37 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx016.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j082ZKE6031615
        for <joris.at.lebbeke@skynet.be>; Sat, 8 Jan 2005 03:35:23 +0100
        (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 06D0D59BD70; Fri,  7 Jan 2005 21:34:59 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx019.isp.belgacom.be (outmx019.isp.belgacom.be
	[195.238.2.200])
	by xserve.flids.com (Postfix) with ESMTP id 044D459BD4D
	for <tiff@remotesensing.org>; Fri,  7 Jan 2005 21:34:57 -0500 (EST)
Received: from outmx019.isp.belgacom.be (localhost [127.0.0.1])
	by outmx019.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id j082YmTf017266
	for <tiff@remotesensing.org>; Sat, 8 Jan 2005 03:34:48 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (83-173.245.81.adsl.skynet.be [81.245.173.83])
	by outmx019.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id j082Ylii017235; Sat, 8 Jan 2005 03:34:47 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <000d01c4f52a$d9634650$53adf551@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Lee Howard" <faxguy@howardsilvan.com>, <tiff@remotesensing.org>
References: <20050107201814.GI21464@bilbo.x101.com>
Subject: Re: [Tiff] JPEG (T.30-E, fax) in TIFF
Date: Sat, 8 Jan 2005 03:36:20 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
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: a6af82db2cc730d02c749c6b83f5d73c

Lee,

> I'm trying to get HylaFAX capable of receiving JPEG-compressed fax
> images per ITU T.30 Annex E.  So far so good, except that I cannot
> properly wrap the JPEG data into TIFF.  HylaFAX uses libtiff anyway,
> and as faxes are often multipage, storing each page in a TIFF file is a
> good way to support multipage faxes.  Thus, I need to get these JPEG
> images into a TIFF wrapper.

I like your reasoning. In fact, a more general JPEG to JPEG-in-TIFF converter
might even be feasable, and useful.

> Would someone kindly take a look at the URL'ed JPEG file(s)...

I don't have the tools, nor sufficient knowledge of the JPEG specification, to
look at the files in detail.

> ...and explain
> to me which TIFF tags I need to use?

I'd say you need to make sure PhotometricInterpretation is set to 10
(PHOTOMETRIC_ITULAB), and Compression is set to 7 (COMPRESSION_JPEG). You also
need to set ImageWidth and ImageLength tags, of course. You should have one
single value of StripOffsets and StripByteCounts, and rows per strip needs to
equal ImageLength. BitsPerSample needs to be 8 (8,8,8, to be more exact, but
LibTiff should take care of that for you), SamplesPerPixel needs to be 3. IIRC,
LibTiff also requires you to set the PlanarConfiguration tag to 1
(PLANARCONFIG_CONTIG), even though the spec says that's the default value and
thus the tag should not be strictly requires.

Now, for the less obvious. You might need to set the Decode tag
(http://www.awaresystems.be/imaging/tiff/tifftags/decode.html), depending on
whether the ITULAB data in the JPEG has default range or not.

You'll also need to set the YCbCrSubSampling tag
(http://www.awaresystems.be/imaging/tiff/tifftags/ycbcrsubsampling.html), since
your subsampling values are not the default. Note that the tag's name
incorrectly seems to imply that it is for YCbCr data only, but it should also
apply in your case.

That's all I can think of.

> I've tried what I've thought to
> be correct, but inevitably I end up getting errors with "StripOffsets"
> and other JPEG warnings when I pass the data through tiffcp.

Perhaps we might be able to spot a problem if you post a code snippet.
Mentioning the exact errors and warnings might also ring a bell.

Note that few TIFF readers are ITULAB aware. I don't know if tiffcp can or
cannot handle such a TIFF you're trying to build. In fact, it may be a challenge
to find a reader that you can use to crosstest your results, and some code
failing to handle your results might not be sufficient to indicate that you
haven't yet succeeded perfectly fine...

Please do keep us posted on the outcome.

Are you a HylaFAX contributor? The HylaFAX links page still links to
libtiff.org. Can you change that, or point me to someone who can? The correct
LibTiff URL is, instead, http://www.remotesensing.org/libtiff/.


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
