I use putImageData and getImageData functions in my project. But I think I came across a limit when using them. I searched but could not find any information about it.
There seems to be a limit of 65536 on Chrome and 32768 on Firefox. Does anyone have any information about this?
The variable "pixelLength" in the example does not give an output when set to 65536.
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var pixelLength = 65535;
var wf = document.createElement("canvas");
wf.width = pixelLength;
wf.height = 16;
var ctx_wf = wf.getContext("2d");
function CreateImageData() {
var data = ctx_wf.createImageData(pixelLength, 1);
for (var i = 0; i < data.data.length; i += 4) {
data.data[i + 0] = 255;
data.data[i + 1] = 0;
data.data[i + 2] = 0;
data.data[i + 3] = 255;
}
return data;
}
var imgData = CreateImageData();
ctx_wf.putImageData(imgData, 0, 0);
var width = c.width;
var height = c.height;
ctx.drawImage(ctx_wf.canvas, 0, 0, pixelLength, wf.height, 0, 0, width, height);