Last active
December 18, 2015 23:49
-
-
Save davidsonfellipe/5864430 to your computer and use it in GitHub Desktop.
Converter image to canvas, using on LenaJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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