node-imager
a super simple nodejs image resizer. resize files on disk or over http / https
Prerequisites
installation
$ npm install node-imager --save
usage
basic usage example:
const express = ;const imager = ;const app = ; app;app;
api
option (String): 'c' - crops the image from the center outwards.
'' - for normal resizing
width (Number): desired width
height (Number): desired height
url (String): can be relative path or remote file on the web
'images/test.png'
'http://i.imgur.com/1KDwL1M.png' --important to prefix with 'http://'
next: callback function
(contentType, imageBuffer) => { }
resize(option, width, height, url, callback);
or
const options = {
width: 500,
height: 500,
format: 'c',
url
};
resizeWith(options, callback);