Open arunpatala opened 8 years ago
Hey, this looks awfully familiar :)
Thanks I guess
Sent from my iPhone
On Feb 27, 2016, at 4:48 PM, Karthik Balakrishnan notifications@github.com wrote:
Hey, this looks awfully familiar :)
— Reply to this email directly or view it on GitHub.
getPixelMapFromId = function(img) { var canvas; if(!canvas) { canvas = document.createElement('canvas'); canvas.width = 170; canvas.height = 50; canvas.getContext('2d').drawImage(img, 0, 0, 170, 50); } var pixelMap = []; for (var i = 0; i < 50; i++) { var temp = []; for (var k = 0; k < 170; k++) { temp.push(Boolean(canvas.getContext('2d').getImageData(k, i, 1, 1).data[3]) ? 1 : 0); }; pixelMap.push(temp); }; return pixelMap; };