imgresizer-node
resize images on the server size
A node library to resize images using ImageMagick
you need ImageMagick on your system
install
You need imagemagick on your machine.
For Windows - download the ImageMaigck Installer
For Linux:
$ sudo apt-get install imagemagick
usage
Resize a folder of images and write to a new folder.
Each image is resized multiple times.
var resize = resize
Resize a single image and control what size the output is written at:
The basic control format for the single image resize
const config_basic = size: width: 400 //proportional based on height in px height: 600 // jpg format or png format format: "jpg" //the quality from 0.0 to 1.0 quality: 10; /** * process single image * @param inpath path for input * @param outpath path for output * @param options the process configurations * @param done the callback */ resize
If ./imgs was a folder with:
- image1.png (2048 x 1536)
- image2.png (2048 x 1536)
Then ./output would contain:
- image1.png (1024 x 768)
- image1.thumb.png (102 x 77)
- image2.png (1024 x 768)
- image2.thumb.png (102 x 77)
installation
$ npm install imgresizer-node