Streaming imagemagick api
$ npm install imagemagick-stream
var im = require('imagemagick-stream');
var read = fs.createReadStream('image.png');
var write = fs.createWriteStream('image-resized.png');
var resize = im().resize('200x200').quality(90);
read.pipe(resize).pipe(write);
// Alternatively
im('image.png')
.resize('200x200')
.quality(90)
.pipe(write);
// Or
im('image.png')
.resize('200x200')
.quality(90)
.to('image-resized.png');
For freehand settings and operations, use .op()
and .set()
.
See the imagemagick docs for a list of available options.
im('image.png')
.set('density', 400)
.set('channel', 'RGB')
.resize('200x200')
.op('gaussian-blur', 0.05)
.to('image-resized.png');
MIT