Skip to content

Invert colors

Nick edited this page Apr 10, 2020 · 4 revisions

How does it work?

The algorithm for inverting the color is very simple. The inverted color is the difference of the maximum color value minus the current value. It's like the opppsite value of your color in color range.

   |----------  -----------------------  ----------|
   0          /\                       /\          255
Dark           |color                   |inverted  Bright

This calculation is typically done for each color chanel. With InvertColors you can contoll the inveration for each chanel.

InvertColors.apply(PImage image, boolean red, boolean green, boolean blue)
Clone this wiki locally