Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formula to increase brightness of RGB?

Tags:

image

rgb

gamma

Quick question!

I have an R G B value and I want to convert to convert it to be 50% brighter. I found a gamma formula but I'm unsure if gamma is the correct way to go.

So far, I'm using:

        r = 255*((R/255.0)^ (1/1.5));
        g = 255*((G/255.0)^ (1/1.5));
        b = 255*((B/255.0)^ (1/1.5));

All I'm doing is multiplying the gamma by 1.5. The image does look brighter, but I'm unsure if its actually 50% brighter or if the formula I'm using is wrong. Is this correct?

like image 302
UnseededAndroid Avatar asked Jun 19 '18 22:06

UnseededAndroid


1 Answers

Literally "make it 50% brighter" is this

r = min(255, r*1.5)
g = min(255, g*1.5)
b = min(255, b*1.5)

You can also transform RGB to HSV map, increase the V [value] and reconvert it again to RGB.

like image 151
Innuendo Avatar answered Oct 19 '22 12:10

Innuendo