TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use the beamer package with a white on black style to create presentations. I included a simple switch to choose black on white for printout. Is there any possibility to also invert the colors of included graphics (maybe only black on white) or define some substitution rules for colors in included graphics?

share|improve this question
Which picture format do you use? – Marco Daniel Nov 8 '11 at 13:44
I use PDF where possible, PNG otherwise. – bnord Nov 8 '11 at 14:09
I don't think you can change all colors of an included PDF or PNG. Maybe there is some color filter setting available in the PDF standard, but I would simply invert the images manually and then use conditionals to include either the one set of the other. – Martin Scharrer Nov 8 '11 at 14:33
Take a look also at tex.stackexchange.com/questions/3322/… – Joseph Wright Nov 8 '11 at 14:36
I guess you can do some imageMagick magic by calling the externam tool if some switch is set. From what I know LaTeX uses pictures without actually doing anything with them so picture manipulations are not possible internally – Martin H Nov 8 '11 at 14:36

If you use PNG or another bitmap file, you can preprocess your file with Imagemagick.

convert -negate in.png out.png

This also works for PDFs. However, the vector data is rasterised and that's not what you aim for.


You can preprocess the file with inkscape. Load the pdf file, then select Extensions → Colour → Negative, and the paper size of the size of your imported PDF. This yields a non-rasterised, inverted PDF.

share|improve this answer
Using convert for png's works just fine but what Inkscape does with my imported PDFs is not useable. – bnord Nov 9 '11 at 7:54
You don't describe what unusable is. But keep in mind that a white parts in PDFs are often not white, but transparent. They have to be transformed to black. – Marco Nov 9 '11 at 10:18
Yes sorry, as a test I imported a PDF generated by graphviz (dot) and one by mathematica, all the text was replaced by some cryptic symbols, changing the import settings didn't help. Of course I can change that in dot but I was looking for a robust way working with more or less arbitrary input. – bnord Nov 9 '11 at 14:33

If you use METAPOST to generate graphics, then you can use metafun to change the color. See Section 8.5 of the metafun manual, which has an example of converting a colored image to black and white at the end of the section (on page 205).

share|improve this answer
Some time ago I tried to use this mechnism to process files converted to mp by pstoedit, but the compilation failed with errors (I don't recall what the issue was). Seems that mp is picky about the input. – Marco Nov 9 '11 at 11:41
@Marco: I have only rried this with hand written metapost. If you can find the offending image that failed, it might be worthwhile to file a bug report. – Aditya Nov 9 '11 at 14:32

Not a LaTeX solution but AFAIK FoxIt Reader can change colors at the preferences: edit → preferences → document colors. Adobe Reader has Edit → Preferences → Accessibility → Replace Document Colors. And at the internet I found that Mac OSX can invert the whole sceen with CTRL-OPT-CMD-8.

share|improve this answer

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.