Received: from mailgate001.isp.belgacom.be (mailgate001.isp.belgacom.be [195.238.6.86])
	by maildelivery002.isp.belgacom.be (Postfix) with ESMTP id 41A0C148002
	for <joris.at.lebbeke@skynet.be>; Fri, 17 Aug 2007 21:25:00 +0200 (CEST)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 17 Aug 2007 21:24:59 +0200
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 l7HJ101i011879;
	Fri, 17 Aug 2007 15:01:58 -0400
Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l7HJ0vBc011876
	for <tiff@lists.maptools.org>; Fri, 17 Aug 2007 15:00:57 -0400
Received: by an-out-0708.google.com with SMTP id d31so62714and
	for <tiff@lists.maptools.org>; Fri, 17 Aug 2007 12:00:56 -0700 (PDT)
DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta;
	h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
	b=gW0MNgaUezJq5a2v7RMKRO5ho+NgqHp/QHu1mQvqwvzANKONLXTIdZ4n4jCUFj6Xpg4wsNLwJiLmx8leLIARH0W2pcwwoJfwzAsbMU06eXPcn8M7lPVx2BhYTvAfaZBbrQKIjsdKmIYgMBbuEvVniJZuflJCFlSHclvDWOLP3L8=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta;
	h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition;
	b=Afo4yssfESwVIDkyzmKBKtj1aQ5AnkLOdBmxYcnXU2dtjJmRMHa1alpjDIMatbHXsOWV94+o1gZ1Jbb7Nb77YDhlLu/OaBVHclvYmmojEg820kB/AcCRAjrfWG1iLMD/ZcQpPgaoNaTM8eCe+mkkGhsGpS27bArNaSguGNXzGqg=
Received: by 10.90.102.20 with SMTP id z20mr5127285agb.1187377256134;
	Fri, 17 Aug 2007 12:00:56 -0700 (PDT)
Received: by 10.100.151.10 with HTTP; Fri, 17 Aug 2007 12:00:56 -0700 (PDT)
Message-ID: <949801310708171200t73fe2ea5q34947d3efc918844@mail.gmail.com>
Date: Fri, 17 Aug 2007 15:00:56 -0400
From: "Christian Henning" <chhenning@gmail.com>
To: "libtiff - Liste" <tiff@lists.maptools.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Subject: [Tiff] How to write a planar tiff file
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.0000272e
X-MSP-STORE: Fri, 17 Aug 2007 21:25:00 +0200
Status:   

Hi there, I'm having problems writing a planar image file. Can
somebody spot the problem in the following code. It's the most basic
writer I can think of.

int main()
{
   TIFF* file = TIFFOpen( "write_test.tif", "w" );

   TIFFSetField( file, TIFFTAG_IMAGEWIDTH  , 100 );
   TIFFSetField( file, TIFFTAG_IMAGELENGTH , 100 );
   TIFFSetField( file, TIFFTAG_COMPRESSION, COMPRESSION_LZW );
   TIFFSetField( file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE );
   TIFFSetField( file, TIFFTAG_BITSPERSAMPLE  , 8 );
   TIFFSetField( file, TIFFTAG_SAMPLESPERPIXEL, 3 );


   std::vector< unsigned char > row( 100 );

   for( int c = 0; c < 3; ++c )
   {
      for( int y = 0; y < 100; ++y )
      {
         int size = TIFFWriteScanline( file
                                     , &row.front()
                                     , y
                                     , c           );

         io_error_if( size == -1, "Write error." );
      }
   }

   TIFFClose( file );
}


Thanks ahead,
Christian
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
