imagemagickresizer

A node library to resize images using ImageMagick

imagemagickresizer

A node library to resize images using ImageMagick

you need ImageMagick on your system

You need imagemagick on your machine.

For Windows - download the ImageMaigck Installer

For Linux:

$ sudo apt-get install imagemagick

Resize a folder of images and write to a new folder.

Each image is resized multiple times.

var resize = require('imagemagickresizer')()
 
resize.folder('./imgs', './output', [{
  width:1024,
  height:768
},{
  width:102,
  height:77,
  name:'thumb'
}], function(){
    console.log('images resized!');
})

Resize a single image and control what size the output is written at:

resize.image('./imgs/balloon.jpg', './output/balloon.jpg', {
    width:600,
    height:400
}, function(err){
    console.log('image is resized')
})

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)
$ npm install imagemagickresizer