Reputation: 90776
I've been looking around for a simple algorithm to get and set the brightness of a pixel, but can't find anything - only research papers and complex libraries.
So does anyone know what is the formula to calculate the brightness of a pixel? And which formula should I use to change the brightness?
Edit: to clarify the question. I'm using Qt with C++ but I'm mainly looking for a generic math formula - I will adapt it to the language. I'm talking about RGB pixels of an image in memory. By "brightness", I mean the same as in Photoshop - changing the brightness makes the image more "white" (a brightness value of 1.0 is completely white), decreasing it makes it more "black" (value of 0.0).
Upvotes: 4
Views: 2499
Reputation: 96109
What do you mean by a pixel?
You can set the brightness of a pixel in an image with '=' you just need to know the memory layout of the image
To set a pixel on the screen is a little more complicated
Upvotes: -1