Skip to content

Instantly share code, notes, and snippets.

@smt
Created May 20, 2014 17:04
Show Gist options
  • Select an option

  • Save smt/ebc6852e750945a6f11e to your computer and use it in GitHub Desktop.

Select an option

Save smt/ebc6852e750945a6f11e to your computer and use it in GitHub Desktop.
node + imagemagick example
var im = require('imagemagick-native');
var fs = require('fs');
var buffer = fs.readFileSync('./test.gif');
// test.gif --> http://c.2dr.me/Vckz
var resizedBuffer = im.convert({
srcData: buffer,
width: 48,
height: 48,
format: 'JPEG',
debug: 1
});
fs.writeFileSync('./test_thumb.jpg', resizedBuffer, 'binary');
// test_thumb.jpg --> http://c.2dr.me/VdFJ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment