I've noticed HTML5 Canvas adds slight discoloration on certain browsers when using drawImage
. I know it happens on Google Chrome and Mozilla Firefox. Internet Explorer and Chrome Android seems to work fine. What is causing this? My context's globalAlpha
is 1.0
. The discoloration is usually 1-5 RGB values off. Note that there are no problems when using Canvas' fillRect
, etc.
Upon further inspection, looks like this is more a problem from the browser combined with Photoshop exported images, and is irrelevant with the Canvas itself.
var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d");
var img = new Image();
img.src = "http://i.imgur.com/NTRjnRb.png";
img.onload = function(){
ctx.fillStyle = "#FFF";
ctx.fillRect(0, 0, 450, 800);
ctx.drawImage(img, 0, 0);
}
</script>