Algorithm to modify brightness for RGB image

image processingrgb

I know there is formula for going RGB -> Luminance, but I need given a brightness parameter to modify the RGB values of an image. How do I do that?

Thanks

Best Answer

The easiest way is to multiply each of the R,G,B values by some constant - if the constant is >1 it will make it brighter, and if <1 it will be darker. If you're making it brighter then you must test each value to make sure it doesn't go over the maximum (usually 255).

Not only is this simpler than the translation from RGB to HSL and back again, but it more closely approximates what happens when you shine a different amount of light at a physical object.