Permalink
Browse files

misc

  • Loading branch information...
1 parent 8352c4e commit 98b867362afda7c27fc99ed1463a9c79e73e6c04 @tj committed Dec 18, 2011
Showing with 7 additions and 1 deletion.
  1. +6 −1 lib/palette.js
  2. +1 −0 test
View
@@ -22,5 +22,10 @@ exports.version = '0.0.1';
*/
function palette(canvas) {
-
+ var ctx = canvas.getContext('2d')
+ , imageData = ctx.getImageData(0, 0, canvas.width, canvas.height)
+ , data = imageData.data
+ , pixels = data.length / 4;
+
+ console.log(pixels);
}
View
1 test
@@ -22,6 +22,7 @@ img.onload = function(){
ctx.fillStyle = 'white';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(img, 0, 0);
+ palette(canvas);
fs.writeFile(out, canvas.toBuffer(), function(err){
if (err) throw err;
console.log('saved %s', out);

0 comments on commit 98b8673

Please sign in to comment.