1 decade ago by xoriuz
hello all..
i just created new plugin for image manipulation, and have a problem to get the image pixels from canvas.
here is my code
"img" is instance of ig.Image
the problem is on
it always throw error: "Uncaught TypeError: Type error"
did i do something wrong?
please kindly advice
i just created new plugin for image manipulation, and have a problem to get the image pixels from canvas.
here is my code
getPixels: function(img) { var canvas = document.createElement('canvas'); canvas.width = img.data.width; canvas.height = img.data.height; var context = canvas.getContext('2d'); context.drawImage(img.data); return context.getImageData(0,0,canvas.width,canvas.height); },
"img" is instance of ig.Image
the problem is on
context.drawImage(img.data);
it always throw error: "Uncaught TypeError: Type error"
did i do something wrong?
please kindly advice