I\'ve been writing an image processing program which applies effects through HTML5 canvas pixel processing. I\'ve achieved Thresholding, Vintaging, and ColorGradient pixel m
You can take a look at the OpenCV docs to see how you could accomplish this: Brightness and contrast adjustments.
Then there's the demo code:
double alpha; // Simple contrast control: value [1.0-3.0]
int beta; // Simple brightness control: value [0-100]
for( int y = 0; y < image.rows; y++ )
{
for( int x = 0; x < image.cols; x++ )
{
for( int c = 0; c < 3; c++ )
{
new_image.at(y,x)[c] = saturate_cast( alpha*( image.at(y,x)[c] ) + beta );
}
}
}
which I imagine you are capable of translating to javascript.