Ghostscript can convert color documents into grayscale. Example commandline:
gs \
-o grayscale.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \
-sProcessColorModel=/DeviceGray \
/path/to/your.pdf
The most recent version of Ghostscript can also check for the CMYK ink coverage of PDF documents (not image by image, but page by page), using a new "device" called inkcov
. Check for the ink coverage of an example PDF:
gs -o - -sDEVICE=inkcov /path/to/your.pdf
Example output:
Page 1
0.00000 0.00000 0.00000 0.02230 CMYK OK
Page 2
0.02360 0.02360 0.02360 0.02360 CMYK OK
Page 3
0.02525 0.02525 0.02525 0.00000 CMYK OK
Page 4
0.00000 0.00000 0.00000 0.01982 CMYK OK
Here 1.00000 would mean 100%, 0.02525 means 2.525% and 0.00000 means 0% ink coverage. You can see here that pages 1+4 are using no color, while pages 2+3 do. This case is particularly 'nasty' for people who want to save on color ink: because all the C, M, Y (and K) values are exactly the same for each of the pages 2+3, they possibly could appear to the human eye not as color pages, but as grayscale (or "rich" grayscale in the case of page 3) anyway. (That is, if each single pixel is mixed with these color values -- of course, if the page is made by four different squares of the same size using "pure" colors each, then you'd get the same ink coverage result).
Now convert the original PDF to a grayscale one, using the command I initially gave. Then check for the ink coverage distribution again (note how the addition of -q
to the parameters slightly changes the output format):
gs -q -o - -sDEVICE=inkcov grayscale.pdf
0.00000 0.00000 0.00000 0.02230 CMYK OK
0.00000 0.00000 0.00000 0.02360 CMYK OK
0.00000 0.00000 0.00000 0.02525 CMYK OK
0.00000 0.00000 0.00000 0.01982 CMYK OK
pdftex
doesn't change the color settings of included images AFAIK. You would need to do this using an image manipulation program. Have a look at Detecting all pages which contain color and the linked SO post there.