Created
September 7, 2017 09:30
-
-
Save EtherDream/3c2dbd0c441c7f1f0d42eec9ebac4344 to your computer and use it in GitHub Desktop.
This file contains 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
var URL = 'http://gd1.alicdn.com/imgextra/i1/394695430/TB2d4w3cXXXXXc4XXXXXXXXXXXX_!!394695430.jpg'; | |
var img = new Image(); | |
img.onload = function() { | |
var c = document.createElement('canvas'); | |
var w = c.width = img.width; | |
var h = c.height = img.height; | |
ctx = c.getContext('2d'); | |
ctx.drawImage(img, 0, 0); | |
var data = ctx.getImageData(0, 0, w, h); | |
console.log(data); | |
}; | |
img.src = URL; | |
img.crossOrigin = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment