I need to read C M Y and K bits from .tiff image using libtiff
.
I have set this so far:
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 4);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_SEPARATE);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_SEPARATED);
TIFFSetField(tif, TIFFTAG_INKSET, INKSET_CMYK);
TIFFSetField(tif, TIFFTAG_NUMBEROFINKS, 4);
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8,8,8,8);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, h);
npixels=h*w;
raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
if(raster != NULL) {
ImageStatePtr ptr1 = ImageStatePtr(new ImageState(QFileInfo(filename).fileName());
Format f;
f.setColorModel(Format::CMYK);
f.setColorDepth(32);
ptr1->setFormat(f);
while(tif)
{
int C...;//get C pixels
int M...;//get M pixels
int Y...;//get Y pixels
int K...;//get K pixels
}
I hope for a quick answer. TY