ocean.onload = function(){ ctx.drawImage(ocean, W/2 - 325, H/2 - 250, 640 ,480); var myImg = ctx.getImageData(W/2 - 235, H/2 - 250, 640, 481); for (var i = 0; i < myImg.data.length; i += 4) { myImg.data[i] += 25; myImg.data[i + 1] -= 200; myImg.data[i + 2] -= 200; myImg.data[i + 3] = 255; } ctx.putImageData(myImg, W/2 - 325, H/2 - 250); }
Go ahead and play with the values and see how it changes. The amount you set will be added or subtracted from the normal value
Red Value | |
Green Value | |
Blue Value | |
Alpha Value | |
Black and whtie | Inverted |