Skip to content

Instantly share code, notes, and snippets.

@davidsonfellipe
Last active December 18, 2015 23:49
Show Gist options
  • Save davidsonfellipe/5864430 to your computer and use it in GitHub Desktop.
Save davidsonfellipe/5864430 to your computer and use it in GitHub Desktop.
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