Is there a way to convert a colored image to grayscale both for printing as well as screen viewing through pdfLaTeX?
I would suggest using a tool like "convert" of the ImageMagick package (which is usually installed if you're running Linux, but is also available for Windows).
convert -colorspace gray originalfile outputfile
Just a note on this, in respect to Linux tools:
convertcan convert color (mode) of bitmap/raster images to grayscale (it can also convert a pdf to a bitmap/raster image)
ghostscriptcan convert pdfs (that include images) into grayscale pdfs (see comments in graypdf.sh, though; there's problems with metadata)
pdflatexwill cause mostly text color (and, I guess, related vector objects) to be grayscale
So, basically there would be two approaches to generating a gray
pdflatexit in color - and then convert the whole document to gray using
\write18, and use definitions of commands that will generate grayscale image on the fly.
Note that even if converting the whole PDF, the process will not necessarily be straightforward (for more, see Converting (any) PDF to black (K)-only CMYK).
For the second option, there is an example of a
- Can pdflatex (or any tex package) automatically rescale included images which have been reduced in size? #5811692
, which calls
\write18 to generate resized versions of images; I'm guessing it can be relatively easily modified to generate grayscale images instead (it may also be possible to force
convert to return the image data through stdout - so it is directly embedded in the pdf stream, instead of generating an intermediate file; but I wouldn't know how to solve that at the moment).
Anyways, hope this helps someone,