How can I invert the color of an image included via \includegraphics?

  • @samcarter_is_at_topanswers.xyz The question and answer are indeed very close (and I somehow found a similar question to learn about decodearray), but they are hard to find when googling tikz invert color image since my use case is a specific but common use case… But actually I realized that latex invert color image directly points to tex.stackexchange.com/questions/34110/… which is focused specifically on this question, so I'm fine closing this one.
    – tobiasBora
    Commented Jul 10 at 11:33

1 Answer 1


One can use:

\includegraphics[width=4cm,decodearray={1 0 1 0 1 0}]{images/amande_noir.png}

decodearray basically takes for each color component (here RGB, so 3) a tupple (a,b): 0 in the original image is mapped to a, and 1 in the original image is mapped to b:

enter image description here

(if your image is cmyk or grayscale, you need to adapt the number of tupples)

Not the answer you're looking for? Browse other questions tagged .