Return-Path: <jean-yves.leridant@culture.gouv.fr>
Received: from hermes.culture.fr (hermes.culture.fr [143.126.201.210])
        by inmx005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j4QAHbh4028944
        for <joris.at.lebbeke@skynet.be>; Thu, 26 May 2005 12:17:37 +0200
        (envelope-from <jean-yves.leridant@culture.gouv.fr>)
Received: by mta.culture.fr with id j4QAHaRO028678
 for <joris.at.lebbeke@skynet.be>; Thu, 26 May 2005 12:17:37 +0200
Received: from archives.culture.fr (archives.culture.fr) by pasteur.culture.fr
 (Content Technologies SMTPRS 4.3.17) with ESMTP id <T712557619e8f7ec9dc3f4@pasteur.culture.fr>;
 Thu, 26 May 2005 12:16:28 +0200
Received: from PRECISION360 by archives.culture.fr with ESMTP id j4QAHblU009388;
   Thu, 26 May 2005 12:17:37 +0200
Date: Thu, 26 May 2005 12:10:36 +0200
From: Jean-Yves Le Ridant <jean-yves.leridant@culture.gouv.fr>
X-Mailer: The Bat! (v3.0.1.33) Professional
Reply-To: Jean-Yves Le Ridant <jean-yves.leridant@culture.gouv.fr>
Organization: =?gb2312?Q?Minist=E8re_de_la_Culture?=
X-Priority: 3 (Normal)
Message-ID: <459218676.20050526121036@culture.gouv.fr>
To: "yourpattern" <yourpattern@126.com>
CC: "tiff" <tiff@remotesensing.org>, "joris" <joris.at.lebbeke@skynet.be>
Subject: Re[2]: [Tiff] How to Write a tif file with compression = COMPRESSION_JPEG & photometric = PHOTOMETRIC_YCBCR ?
In-Reply-To: <42958FAD.00008B.02034@m52.126.com>
References: <42958FAD.00008B.02034@m52.126.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=gb2312
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by inmx005.isp.belgacom.be id j4QAHbh4028944
X-UIDL: 000000000023ceae.00000280
X-MSP-STORE: Thu, 26 May 2005 12:17:43 +0200
Status:   



y> Hi all,
y>  This time i scrathed some codes from rgb2ycbcr.c which is
y> distributed with libtiff/tools.It works, and i successfully created
y> the tif image file with compression = COMPRESSION_JPEG &
y> photometric = PHOTOMETRIC_YCBCR , and can be opened by ACDSEE.

Produce a one strip, YCBCR, whatever downsampled image,
and tiffcp, tiffdump, or tiffinfo it ...
;-)))))
With libtiff 3.7.2 ...


y> But i still have some thoughts about this things:
y> Jean Yves:
y>  you said that libtiff already can do this thing(save the tif
y> image file with compression = COMPRESSION_JPEG & photometric =
y> PHOTOMETRIC_YCBCR ), 
y> I tried,but failed. Do you have done such things before ? if
y> so,tell me what's wrong in my codes,or tell me how to do ? thanks .

Concerning *pseudo-tag* JPEGCOLORMODE_RGB, I used and use it,
and it worked and work fine.
What I can imagine, from what I see in code, may be problems relying
to order in which you set fields as PLANARCONFIG, PHOTOMETRIC,
JPEGCOLORMODE, COMPRESSION ...

y> [ and i looked at manual page of TIFFWriteScanLine()...,it is said,there is a bug related
y> to this:
y> "Writing subsampled YCbCR data does not work correctly because,
y> for PlanarConfiguration=2 the size of a scanline is not calculated
y> on a per-sample basis, and for PlanarConfiguration=1 the library
y> does not pack the block-interleaved samples."

Seen this after asked some stupid questions there or/and at bugzilla.
Notion of scanline for vertically subsampled data is somewhat hazardous.
And that tif_jpeg use it for subsampled data ... ;-(

y> so i shift to use TIFFWriteEncodedStrip....,(there is no bug
y> reports in manual page about this function),but it still can't
y> work.). 

Strip and tile fonctions, in turn call TIFFVxxxSize fonctions,
which give correct result regarding downsampling.
So defining scanlinesize as Stripsize(v_sampling) may have some consistance.

Best is processing subsampling by stripe and tile.

--
Jean-Yves




