1994.07.10 11:46 "tiff separated problem", by Dwight Kelly
I need to write a separated CMYK 1-bit file using the libtiff routines. There is not a problem when I write one plane at a time, however, when I try to write one scanline for each color I get a core dump in DumpEncode. Below is sample code that demonstrates the problem.
#include <tiffio.h>
int
main()
{
TIFF *bitsFile;
int clr, hpix;
unsigned char *buf[4];
bitsFile = TIFFOpen("output.001", "w");
TIFFSetField(bitsFile, TIFFTAG_IMAGEWIDTH, 2550);
TIFFSetField(bitsFile, TIFFTAG_IMAGELENGTH, 3300);
TIFFSetField(bitsFile, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_SEPARATED);
TIFFSetField(bitsFile, TIFFTAG_INKSET, INKSET_CMYK);
TIFFSetField(bitsFile, TIFFTAG_SAMPLESPERPIXEL, 4);
TIFFSetField(bitsFile, TIFFTAG_BITSPERSAMPLE, 1);
TIFFSetField(bitsFile, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE);
for (clr = 0; clr < 4; clr++) {
buf[clr] = (unsigned char *) malloc(TIFFScanlineSize(bitsFile));
}
for (hpix = 0; hpix < 3300; hpix++) {
for (clr = 0; clr < 4 ; clr++) {
TIFFWriteScanline(bitsFile, buf[clr], hpix, clr);
}
}
TIFFClose(bitsFile);
return 0;
}
--
Dwight Kelly
Essential Technical Services, Inc.
3375 Summit Trail Cumming, GA 30131
(404) 889-2848 (404) 889-2624 fax
Internet: dkelly@etsinc.com