Return-Path: <tiff-bounces@lists.maptools.org>
Delivered-To: info@awaresystems.be
Received: (qmail 12963 invoked from network); 18 Jun 2008 12:29:52 -0000
Received: from janet.telenet-ops.be ([195.130.136.6])
          (envelope-sender <tiff-bounces@lists.maptools.org>)
          by angelia.telenet-ops.be (qmail-ldap-1.03) with SMTP
          for <info@awaresystems.be>; 18 Jun 2008 12:29:52 -0000
Received: from waldo.telenet-ops.be (waldo.telenet-ops.be [195.130.136.10])
	by janet.telenet-ops.be (8.13.1/8.13.1) with ESMTP id m5ICTqPl012476
	for <info@awaresystems.be>; Wed, 18 Jun 2008 14:29:52 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
	by waldo.telenet-ops.be (Postfix) with SMTP id 8D2621C002
	for <info@awaresystems.be>; Wed, 18 Jun 2008 14:29:52 +0200 (CEST)
Received: from kelmis.telenet-ops.be (kelmis.telenet-ops.be [195.130.132.52])
	by waldo.telenet-ops.be (Postfix) with ESMTP id 86DD71C006
	for <info@awaresystems.be>; Wed, 18 Jun 2008 14:29:52 +0200 (CEST)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153])
	by kelmis.telenet-ops.be (Postfix) with ESMTP id 20E82332793
	for <info@awaresystems.be>; Wed, 18 Jun 2008 14:29:51 +0200 (CEST)
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 m5ICRKAW031962;
	Wed, 18 Jun 2008 08:28:44 -0400
Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m5ICRIiA031959
	for <tiff@lists.maptools.org>; Wed, 18 Jun 2008 08:27:19 -0400
Received: by py-out-1112.google.com with SMTP id u77so70541pyb.23
	for <tiff@lists.maptools.org>; Wed, 18 Jun 2008 05:27:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:organization:to:subject:date
	:user-agent:mime-version:content-type:content-transfer-encoding
	:content-disposition:message-id:from;
	bh=xtSdI8lcYn7dE/lrfh8lnSPih+EQCHYrbyEwt4yEUmc=;
	b=VW6ADvoErZHCqP0mKp8qMn4H44eSKw+uuN3zeSj85Bqyrvo29Ezclq268R6ZX5G9ei
	1apw+2+lwqihE8fZlzXQGUsoeKeZ5vLsn5NoFFgkYCoPCLCWMtMCmoME4GjIsAlA86ia
	kVqInTm1sQxGkNhhopZ07RdzwGoSIBYFSU90s=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=organization:to:subject:date:user-agent:mime-version:content-type
	:content-transfer-encoding:content-disposition:message-id:from;
	b=NIcGi1QU1qtmqreH7rgaoUHRj+Z4LM59C6gEDC14+PWZmKQ015wBEe/4/SfqOWwbRi
	FMcl4F/aiCwhQZvx85muf04g65p16SMYjrtfAQ/AcqvSIQ6MNAx+L32lqE+9j7kTeE9I
	j6AonPrRDq8p/kd/5lyjYo9NZpBLvW67zD1yI=
Received: by 10.114.56.1 with SMTP id e1mr618366waa.69.1213792037979;
	Wed, 18 Jun 2008 05:27:17 -0700 (PDT)
Received: from ?192.168.1.22? ( [82.76.35.141])
	by mx.google.com with ESMTPS id 7sm1665292wrh.40.2008.06.18.05.27.15
	(version=SSLv3 cipher=RC4-MD5); Wed, 18 Jun 2008 05:27:16 -0700 (PDT)
Organization: Sytron Technologies
To: tiff@lists.maptools.org
Date: Wed, 18 Jun 2008 15:27:14 +0300
User-Agent: KMail/1.9.6 (enterprise 20070904.708012)
MIME-Version: 1.0
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200806181527.14285.bogdan.cristea@sytron.ro>
From: Bogdan Cristea <cristeab@gmail.com>
Subject: [Tiff] changing compression scheme
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-SpamCatcher-Score: 50 [XX]

    I need to convert a TIFF file into a TIFF Class F file. I am aware of the 
fax2tiff utility, but I need to add more flexibility.
    I have tried to decompress the data with TIFFReadEncodedStrip and 
recompress again with TIFFWriteEncodedStrip, but the generated tiff file 
seems to have problems with some readers (xv).
   Below is the piece of code I have used. Can anyone explain what I am doing 
wrong?

	TIFFSetField(outImage, TIFFTAG_IMAGEWIDTH, 1728);
	TIFFSetField(outImage, TIFFTAG_IMAGELENGTH, 2240);

	TIFFSetField(outImage, TIFFTAG_BITSPERSAMPLE, 1);
	TIFFSetField(outImage, TIFFTAG_SAMPLESPERPIXEL, 1);

	TIFFSetField(outImage, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
	TIFFSetField(outImage, TIFFTAG_T6OPTIONS, 0);

	rowsPerStrip = TIFFDefaultStripSize(outImage, 0);
	TIFFSetField(outImage, TIFFTAG_ROWSPERSTRIP, rowsPerStrip);
	
	TIFFSetField(outImage, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
	TIFFSetField(outImage, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
	TIFFSetField(outImage, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

	TIFFSetField(outImage, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);

	TIFFSetField(outImage, TIFFTAG_XRESOLUTION, 200.0);
	TIFFSetField(outImage, TIFFTAG_YRESOLUTION, 200.0);
	TIFFSetField(outImage, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER);	

		for (U32 count=0;count<TIFFNumberOfStrips(inImage);count++)
		{
			if ((stripBufferLen = TIFFReadEncodedStrip(inImage, count, 
stripBuffer, -1)) == -1)
			{
				fprintf(stderr, "TP::tiff2ClassFTiff: read error on input strip number %d.
\n", count);
				break;
			}
			if (TIFFWriteEncodedStrip(outImage, count, stripBuffer, stripBufferLen) 
== -1)
			{
				fprintf(stderr, "TP::tiff2ClassFTiff: write error on input strip 
number %d.\n", count);
				break;
			}
		}

-- 
Bogdan Cristea
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
