Try with imagemagick
package for NodeJS: https://github.com/yourdeveloper/node-imagemagick
im.crop({
srcPath: process.argv[2],
dstPath: 'cropped.' + process.argv[2].split('.').pop(),
width: 200,
height: 200,
quality: 1,
gravity: 'Center'
}, function(err, stdout, stderr){
if (err) throw err;
console.log('resized ' + process.argv[2].split('/').pop() + ' to fit within 200x200px');
});
Update: Please note that the node-imagemagick package hasn't been updated in quite a long time. Please consider Freyday's answer since it's most up-to-date.