Efficient image resize with multiple versions support
npm install im-resize




Efficient image resize with support for multiple thumbnail configurations using
ImageMagick's convert command.
* ImageMagick
```
npm install im-resize --save
`js`
var resize = require('im-resize');
Resize a given source image into several versions.
* object image - source image to resizewidth
* integer - image pixel widthheight
* integer - image pixel heightpath
* string - complete path to source imageoutput
* object - image resize output configprefix
* string image versions name prefix (default "")path
* string image versions directory pathquality
* integrer - global version quality (default 80)versions
* object[] - array of version objectssuffix
* string - suffix for the resized image (ex. -small)maxWidth
* integer - max width for resized imagemaxHeight
* integer - max height for resized imagequality
* integer - quality for resized image (default 80)aspect
* string - force aspectratio on resized image (ex. 4:3)flatten
* boolean - used in conjunction with backgroundbackground
* string - set background to transparent image (ex. red)format
* string - image format for resized image (ex. png)cb
* function - callback function (Error error, object[] versions)error
* Error - error output if command failedversions
* object[] - resized image versionspath
* string path to the resized image
#### Example
`js
var image = {
path: '/path/to/image.jpg',
width: 5184,
height: 2623
};
var output = {
versions: [{
suffix: '-thumb',
maxHeight: 150,
maxWidth: 150,
aspect: "3:2"
},{
suffix: '-square',
maxWidth: 200,
aspect: "1:1"
}]
};
resize(image, output, function(error, versions) {
if (error) { console.error(error); }
console.log(versions[0].path); // /path/to/image-thumb.jpg
console.log(versions[0].width); // 150
console.log(versions[0].height); // 100
console.log(versions[1].path); // /path/to/image-square.jpg
console.log(versions[1].width); // 200
console.log(versions[1].height); // 200
});
``