Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to provide different versions of an image/figure, and have the pdf viewer choose which one is the best at viewing time?

I would like to have a color image on screen and on color printers, and a grayscale image on a black and white printer.

share|improve this question
Compile two different documents, much easier. Otherwise you need to go into javascript, which not all viewers can use. –  zeroth Mar 20 at 13:52
I second @zeroth, but will note that Ghostscript/ImageMagick can be very useful here. –  Sean Allred Mar 24 at 3:18

1 Answer 1

Strictly technically speaking, yes, PDF (beginning from version 1.3) supports alternate images (eventually from remote resources) with different resolutions and colour spaces in order to let the PDF viewer choose which version to use depending on the destination device (screen, colour printer, grayscale printer). Certain substandards (e.g. PDF/A) might not support these feature, though. (See Section Alternate Images, Document management — Portable document format — Part 1: PDF 1.7, Adobe Systems Incorporated, 2008)

In practice though, unfortunately, there seems to be no support for this valuable feature in the Latex- or "open-source PDF"-World, so to speak. Some professional proprietary products (e.g. Adobe Illustrator) do support this feature though. Supposedly creating the "dual-colour-space" images/figures in Illustrator if possible and including those PDFs in your Latex-Document might produce the result you are looking for... maybe.

A trade-off between native alternate images and multiple versions of the document (latter of which is not suitable for paper submission to conferences, e.g.) could be Optional Content Groups (OCG) (starting from PDF 1.5... I think). Those can be produced with the package ocgx but would still require the user to select the correct layer/OCG (colour vs. grayscale e.g.). OCGs are not (yet) supported by all viewers, but those viewers known for maximum coformity (e.g. Adobe Reader, Foxit Reader, Okular) do support OCGs.

share|improve this answer
Addendum (for the sake of completeness): Apparently even Adobe Reader does not choose the alternate image with the colourspace corresponding to the output device (at least it does not in the case of grayscale printing on a colour printer). The only diffrerence made is between Print and View which is supported by pdflatex (tex.stackexchange.com/questions/68891/…) (but only for bitmap graphics). OCGs can provide ("automatic") layers for Print and View, too (which is not limited to bitmap graphics). But that does not solve your problem per se. –  Pierre Schroeder Mar 26 at 19:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.