Resize images in memory
$ npm install --save resize-img
const fs = require('fs');
const resizeImg = require('resize-img');
resizeImg(fs.readFileSync('unicorn.png'), {width: 128, height: 128}).then(buf => {
fs.writeFileSync('unicorn-128x128.png', buf);
});
Type: buffer
An image buffer. Supported formats are bmp
, jpg
and png
.
Type: number
Desired width of the target image.
Type: number
Desired height of the target image.
- resize-img-cli - CLI for this module.
MIT © Kevin Martensson