javascript canvas gamma correction
var gamma = 2.2;
var gammaCorrection = 1 / gamma;
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
var oldColor = getPixel(x, y);
var newColor = [
Math.pow((oldColor[0] / 255), gammaCorrection) * 255,
Math.pow((oldColor[1] / 255), gammaCorrection) * 255,
Math.pow((oldColor[2] / 255), gammaCorrection) * 255
];
updatePixel(x, y, newColor[0], newColor[1], newColor[2]);
}
}
renderPixels();