Learn creative coding writing simple programs
90. Change pixel hue, saturation and brightness
For most people it is easier to think about about a color in terms of hue, saturation and brightness than in terms of red, green and blue. Yellow is one hue, but is made of red and green, which might not be very intuitive.
In this episode we learn how we can read the hue, saturation and brighness of the pixels in our display. We then use that information to define a new color for each pixel.
Using this technique we can create programs that modify the colors of any image.
Code editor
You can make changes to the code below. Then
Reference
brightness
color
colorMode
draw
else
float
for
hue
if
image
int
loadImage
loadPixels
PImage
pixels
saturation
setup
size
updatePixels
void
brightness
color
colorMode
draw
else
float
for
hue
if
image
int
loadImage
loadPixels
PImage
pixels
saturation
setup
size
updatePixels
void
Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)
To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```