Suppose I have a document that includes a lot of colorful PDFs. Now I'd like to easily switch between "color" version and "greyscale version". I'm aware of \DeclareGraphicsRule
, but I think this needs more tweaking. See the MWE below.
% engine: pdflatex
\documentclass{article}
\usepackage{xcolor,graphicx}
\iftrue
% code for "color" version
\else
% code for "grayscale" version
\fi
\begin{document}
\includegraphics{z4z.pdf}
\end{document}
You can use any image you want, but the one I used is here: http://kmlinux.fjfi.cvut.cz/~hejdato1/z4z.pdf
The command that can be used to convert image to greyscale is e.g.
convert -density 600 #1.pdf -colorspace Gray #2.pdf
Last but not least, it would be nice if it worked both with and wihout the .pdf
extension in \includegraphics
.