pdfGetImageNumComponents

Get the number of components per pixel for an image.
int pdfGetImageNumComponents(PDFHandle pdf, int idx)
This function returns the number of pixel components (which depends on the color space being used) for the idxth image on the page specified in the last call to pdfGetImages.

For most color spaces, the number of components is determined by the color space - DeviceGray has one component, DeviceRGB has three components, etc. But some color spaces, e.g., DeviceN, can have variable numbers of components.

C:
double low, high; int nImgs, i, j, mask, colorSpace, w, h, nComps; pdfGetImages(pdf, 1); nImgs = pdfGetNumImages(pdf); for (i = 0; i < nImgs; ++i) { pdfGetImageInfo(pdf, i, &mask, &colorSpace, &w, &h); nComps = pdfGetImageNumComponents(pdf, i); printf("image %d: %s with %d components\n", i, pdfGetColorSpaceName(colorSpace), nComps); for (j = 0; j < nComps; ++j) { pdfGetImageDecodeRange(pdf, i, j, &low, &high); printf(" decode: %g %g\n", low, high); } }
pdfGetImages
pdfGetNumImages
pdfGetImageDecodeRange