The filter(INVERT) function question

Hello everyone!!

I would like to ask if when using the ‘INVERT’ in the filter() function, apart from inverting the hue value, are the saturation and brightness values inverted as well or not please?

When trying it out on a picture, my perception is that it does inverts the saturation and brightness but in my course study guides , they state that only the hue values are inverted. Can someone please point me in the right direction? :slightly_smiling_face:

Thank you very much for your help!

I don’t know off the top of my head but you could use the brightness() and saturation() methods to find out. The following code should print out the results.

// run twice
image(img, 0, 0);
filter(INVERT); // comment this line out one of the times you run it
loadPixels();
println("Brightness: " + brightness(img.pixels[0]));
println("Saturation: " + saturation(img.pixels[0]));
// compare the values from the two runs to see if they've changed

1 Like

Thank you very much!! Did not think about accessing the values with those methods! Thanks for suggesting!

Just tried it now and it does actually invert the saturation and brightness as well. In a pixel where originally it has almost full saturation and almost nil brightness, when inverted it becomes the other way round. Full brightness and nil saturation.

I will point this to my tutor.

Thanks again much appreciated and hope this will be helpful to others :slight_smile:

1 Like