public Channel gain(float gain) {
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (getPixel(x, y) < 0.5f)
putPixel(x, y, (float)(Math.Pow(2 * getPixel(x, y), Math.Log(1 - gain)/Math.Log(0.5d))/2f));
else
putPixel(x, y, 1f - (float)(Math.Pow(2 - 2 * getPixel(x, y), Math.Log(1 - gain)/Math.Log(0.5d))/2f));
}
}
return this;
}