Permalink
Browse files

saving

  • Loading branch information...
1 parent ca2f984 commit 91056c5b1a52c4dc50da7c7b84d3a28f8266c68b @tj committed Dec 18, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 test
View
@@ -1,6 +1,7 @@
#!/usr/bin/env node
var palette = require('./')
+ , fs = require('fs')
, Canvas = require('canvas')
, Image = Canvas.Image
, canvas = new Canvas
@@ -18,6 +19,11 @@ var img = new Image;
img.onload = function(){
canvas.width = img.width;
canvas.height = img.height;
+ ctx.drawImage(img, 0, 0);
+ fs.writeFile(out, canvas.toBuffer(), function(err){
+ if (err) throw err;
+ console.log('saved %s', out);
+ });
};
img.src = path;

0 comments on commit 91056c5

Please sign in to comment.