Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converter image to canvas, using on LenaJS
//Método do LenaJS que converte uma imagem para o tipo ImageData
LenaJS.getImage = function(img) {
var c = document.createElement('canvas');
c.width = img.width;
c.height = img.height;
var ctx = c.getContext('2d');
ctx.drawImage(img, 0, 0);
return ctx.getImageData(0, 0, img.width, img.height);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.