| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2006.05.25 17:24 "libtiff writes zero valued tile offsets and byte counts", by Thomas SharplessMy scanning camera app writes tiled tiff images using libtiff under Win32.
The images are readable by PhotoShop (6.01) but not by PaintShop Pro 7 or
libtiff itself. The problem seems to be that all the tile offsets and
bytecounts in the file are zero (their number is correct). Can anyone tell
me why?
I creates the file thus:
ptiff = TIFFOpen(OPFileName, "w");
if( ptiff ) {
TIFFSetField( ptiff, TIFFTAG_IMAGEWIDTH, pSC->img_cols );
TIFFSetField( ptiff, TIFFTAG_IMAGELENGTH, pSC->img_rows );
TIFFSetField( ptiff, TIFFTAG_COMPRESSION, 1 ); // uncompressed
TIFFSetField( ptiff, TIFFTAG_PLANARCONFIG, 1 ); // contiguous
TIFFSetField( ptiff, TIFFTAG_SAMPLESPERPIXEL, pSC->scn_cpp );
if( pSC->scn_cpp == 1){ // greyscale
TIFFSetField( ptiff, TIFFTAG_BITSPERSAMPLE, 8 * pSC->img_bpc );
TIFFSetField( ptiff, TIFFTAG_PHOTOMETRIC, 1 ); // 0 is black
} else { // RGB
int n = 8 * pSC->img_bpc;
TIFFSetField( ptiff, TIFFTAG_BITSPERSAMPLE, n, n, n );
TIFFSetField( ptiff, TIFFTAG_PHOTOMETRIC, 2 ); // RGB
}
// tile size
TIFFSetField( ptiff, TIFFTAG_TILELENGTH, pTB->getHgt() );
TIFFSetField( ptiff, TIFFTAG_TILEWIDTH, pTB->getWid() );
// verify
if (!TIFFCheckTile(ptiff, 0,0,0,0)) fail();
write each tile thus:
if( TIFFWriteTile( ptiff, pdata, imgx, imgy, 0, 0 ) < 1 ) fail();
and call TIFFclose( ptiff ) at the end.
|
|||||||