amyn
amyn

Reputation: 942

Detect if PDF is colored [DATALOGICS][APDFL]

I am using APDFL 10.1.0 to convert PDF to images. This is how I am loading the PDF file and saving a specific page as image:

Document pdfdocument = null;
pdfdocument = new Document(docpath);
Page docpage = pdfdocument.GetPage(pagelist[0]);
Image pageimage = docpage.GetImage(PageRect);

Is there a way to detect from either the docpage variable or the pageimage variable if the specific page is colored or is grayscale?

Upvotes: 2

Views: 279

Answers (1)

dl-chrisf
dl-chrisf

Reputation: 61

You can use pageImage.NumberComponents to determine this. Color Images will have 3 or 4 components (depending on whether it is an RGB Image or a CMYK Image) while grayscale Images will have 1 component.

Upvotes: 0

Related Questions