How to find Number of color pages

  • Follow


Hi,
    How can we determine whether a given page in a pdf document is
colour or b/w?
do we have to go through each and every element of a page identifying
its colour space?
Is there standard algorithm to do this?

Thanks and Regards,
Suhel

0
Reply suhelmomin (1) 3/23/2006 10:57:59 AM

"Suhel" <suhelmomin@gmail.com> wrote:

>    How can we determine whether a given page in a pdf document is
>colour or b/w?
>do we have to go through each and every element of a page identifying
>its colour space?

Yes. But first you have to decide *exactly* what you mean by "in
colour".  For example, if an RGB image contains only pixels in black,
and white, is it colour? You may need to check all colour values.

Are there Lab and CMYK values you would consider b/w?

What about shadings?

>Is there standard algorithm to do this?

Not even any agreement on what is meant by colour.
----------------------------------------
Aandi Inston  quite@dial.pipex.com http://www.quite.com
Please support usenet! Post replies and follow-ups, don't e-mail them.

0
Reply quite 3/23/2006 12:23:21 PM


The tool that comes with ghostscript in the contrib directory just does 
this:

1) render each page to rgb in memory using a fixed resolution
2) look at each pixel of each page if there is a difference between r,g 
and b
3) if there is a difference it assumes the page is color, if not it 
assumes it is monochrome

Depending on the results it trys to split postscript files into colored 
and monochrome pages. However this feature can be removed and after that 
it works on postscript and pdf.
So it is built on the top of ghostscripts ability to raster and 
interpret colors (rgb and cmyk content) and does not have the problem to 
do it itself.
Could be problematic in some rare cases, because of colorinterpretation 
problems or problems because of little elements falling through the 
raster. But for what most of us need it is good enough.
Best regards,
Carsten

Aandi Inston schrieb:
> "Suhel" <suhelmomin@gmail.com> wrote:
> 
>>    How can we determine whether a given page in a pdf document is
>> colour or b/w?
>> do we have to go through each and every element of a page identifying
>> its colour space?
> 
> Yes. But first you have to decide *exactly* what you mean by "in
> colour".  For example, if an RGB image contains only pixels in black,
> and white, is it colour? You may need to check all colour values.
> 
> Are there Lab and CMYK values you would consider b/w?
> 
> What about shadings?
> 
>> Is there standard algorithm to do this?
> 
> Not even any agreement on what is meant by colour.
> ----------------------------------------
> Aandi Inston  quite@dial.pipex.com http://www.quite.com
> Please support usenet! Post replies and follow-ups, don't e-mail them.
> 
0
Reply Carsten 3/23/2006 5:26:37 PM

2 Replies
276 Views

(page loaded in 0.094 seconds)

5/4/2013 3:45:53 PM


Reply: