Canvas getImageData在FF中返回错误的像素颜色值

时间:2019-03-19 08:25:23

标签: javascript html5 canvas getimagedata

这是测试https://jsfiddle.net/mgevlich/fqxbntyj/22/

var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var pix = ctx.getImageData(0, 0, img.width, img.height).data;
var ind = (y * img.width + x) << 2;
return [pix[ind], pix[ind + 1], pix[ind + 2], pix[ind + 3]];

如果触摸绿色区域,则会在FF的R通道中找到1,但没有1值,只有绿色!它仅在FF中发生。有人猜出这张图片有什么问题吗?)) 预先感谢!

0 个答案:

没有答案