Skip to content

Instantly share code, notes, and snippets.

@nathanbowser
Created January 29, 2013 18:08
Show Gist options
  • Save nathanbowser/4666257 to your computer and use it in GitHub Desktop.
Save nathanbowser/4666257 to your computer and use it in GitHub Desktop.
module.exports.thumb = function (buffer) {
var full = new Buffer(buffer, 'base64') // Convert base64 encoded value into binary
, thumbStream = new stream.Stream() // Create a new writable stream
im(full).thumb(800, 450, 100, 'topLeft', function (err, stdout, stderr) {
var writeStream = fs.createWriteStream('n.jpg')
stdout.pipe(thumbStream)
})
return thumbStream
}
//
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment