- 2007.08.07 03:46 "[Tiff] bilevel image scrambling when size not divisible by 8", by Lee Cooper
- 2007.08.07 14:48 "Re: [Tiff] Indexed Images", by Toby Thain
- 2007.08.07 15:23 "Re: [Tiff] Indexed Images", by Frank Warmerdam
- 2007.08.13 22:43 "[Tiff] 16-bit palette image", by Christian Henning
2007.08.17 19:00 "[Tiff] How to write a planar tiff file", by Christian Henning
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