Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas015.isp.belgacom.be (localhost [127.0.0.1])
        by inav004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k6E7horq004845
        for <joris.at.lebbeke@skynet.be>; Fri, 14 Jul 2006 09:43:50 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx004.isp.belgacom.be (inmx004.isp.belgacom.be [195.238.5.48])
        by inas015.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k6E7hkDX017517
        for <joris.at.lebbeke@skynet.be>; Fri, 14 Jul 2006 09:43:47 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx004.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id k6E7hc3Y001940
        for <joris.at.lebbeke@skynet.be>; Fri, 14 Jul 2006 09:43:38 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k6E7b9JO008878;
	Fri, 14 Jul 2006 03:37:12 -0400
Received: from outmx011.isp.belgacom.be (outmx011.isp.belgacom.be
	[195.238.5.3])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k6E7b6PU008875
	for <tiff@lists.maptools.org>; Fri, 14 Jul 2006 03:37:07 -0400
Received: from outmx011.isp.belgacom.be (localhost [127.0.0.1])
	by outmx011.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22)
	with ESMTP id k6E7b384024650
	for <tiff@lists.maptools.org>; Fri, 14 Jul 2006 09:37:03 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (151.153-246-81.adsl-dyn.isp.belgacom.be
	[81.246.153.151])
	by outmx011.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22)
	with SMTP id k6E7axWv024583; Fri, 14 Jul 2006 09:36:59 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <003801c6a718$6ac3ac20$9799f651@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "<hotmail>xiaotiger666" <xiaotiger666@hotmail.com>,
        "tiff" <tiff@lists.maptools.org>
References: <BAY103-DAV1728565595C16F5C25CCD78B6F0@phx.gbl><003a01c6a6ff$c6b17df0$9799f651@dfgrrxsknr4e>
	<BAY103-DAV2DD42D31F2E6ADB8201F78B6F0@phx.gbl>
Subject: Re: [Tiff] The problem of Convert tiff
Date: Fri, 14 Jul 2006 09:36:27 +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.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807
Cc: 
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00001879
X-MSP-STORE: Fri, 14 Jul 2006 09:43:57 +0200
Status:   

<hotmail>xiaotiger666 wrote:
> I convert Tiff  with LibTiff. I develop tiff for the Dialogic.
> The Dialogic require the tiff of TIFF/F class. So i must convert the
> all format of tiff  to   TIFF/F class.

I've never thought highly of the artificial classification of TIFF, but,
as far as that classification makes any sense, I think your source image
already is TIFF/F.

> strTime.Format("%d-%2d-%2d...

This is where the bogus format for the DateTime tag comes from. Look up
the correct format in the TIFF spec. It's not crucial, but you may as
well get it right.

> TIFFGetField(srcImage,TIFFTAG_ROWSPERSTRIP,&rowperstrip);

You read the RowsPerStrip value from the source image, you next set that
same value on the destination image...

>   TIFFSetField(image, TIFFTAG_ROWSPERSTRIP,rowperstrip);

...and next transcode all individual strips...

>   uint32 rowsperstrip;
>   (void) TIFFGetFieldDefaulted(srcImage, TIFFTAG_ROWSPERSTRIP,
>   &rowsperstrip); tstrip_t s, ns = TIFFNumberOfStrips(srcImage);
>   uint32 row = 0;
>   for (s = 0; s < ns; s++) {
>    tsize_t cc = (row + rowsperstrip > lv) ?
>     TIFFVStripSize(srcImage, lv - row) : stripsize;
>    TIFFReadEncodedStrip(srcImage, s, buf, cc);
>    if (TIFFWriteEncodedStrip(image, s, buf, cc) < 0) {
>     _TIFFfree(buf);
>    }
>    row += rowsperstrip;
>   }
>   TIFFWriteDirectory(image);
>   _TIFFfree(buf);

That seems OK, at first sight. Maybe someone else spots an error. If
not, try moving the line where you set the TIFFTAG_ROWSPERSTRIP value of
the destination image someplace else, like right before or right after
the line where you set PLANARCONFIG, sometimes that makes a difference.
Try doing the same with the setting of IMAGELENGTH.


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@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
