Given a set of PDF files among which some pages are color and the remaining are black & white, is there any program to find out among the given pages which are color and whi
I would try to do it like that, although there might be other easier solutions, and I'm curious to hear them, I just want to give it try:
For the page count, you can probably translate that without too much effort to Perl. It's basically a regex. It's also said that:
r"(/Type)\s?(/Page)[/>\s]"
You simply have to count how many times this regular expression occurs in the PDF file, minus the times you find the string "<>" (empty ages which are not rendered).
To extract the image, you can use ImageMagick to do that. Or see this question.
Finally, to get whether it is black and white, it depends if you mean literally black and white or grayscale. For black and white, you should only have, well, black and white in all the image. If you want to see grayscale, now, it's really not my speciality but I guess you could see if the averages of the red, the green and the blue are close to each other or if the original image and a grayscale converted one are close to each other.
Hope it gives some hints to help you go further.