The best way to brighten any image without destroying it, is gamma up the magnitude.
The traditional methods of brightening ie photoshop, are gain & gamma, gain/brightness will blow out the image and clip it, gamma up will wash out and desaturate the image.
A better method is to seperate the color component from the "energy" (magnitude) of the pixels and gamma the "energy" up, then re-insert it into the image.
Consider the image rgb as a vector rgb = xyz, scaling the magnitude will not change the angle of the vector, or in the image's case the relationship of r,g,b to each other., like this:
magnitude = sqrt(r*r + g*g + b*b);
r_tmp = r/mag;
g_tmp = g/mag;
b_tmp = b/mag;
mag_tmp = powf(magnitude, 1.0/gamma);
r = r*mag_tmp;
g = g*mag_tmp;
b = b*mag_tmp;
return r,g,b;
here's my method vs traditional methods: