image-file-optimizer
v1.0.3
Published
With this Node module you can easily optimize image files, It accepts JSON format data & converts to form data and process request for optimization.
Downloads
3
Readme
image-file-optimizer
With this Node module you can easily optimize image files, It accepts JSON format data & converts to form data and process request for optimization.
Installation
- Just include image-file-optimizer before your scripts.
npm install image-file-optimizer
if you’re using node.js.
Usage
const optimizer = require('image-file-optimizer');
const reqParam = {
s3Path: 'provide your s3 path',
lossy: true,
webp: true,
rename: false,
resize: [
{
id: 'small',
strategy: 'fit',
width: 100,
height: 100
},
{
id: 'medium',
strategy: 'crop',
width: 300,
height: 300
},
{
id: 'large',
strategy: 'square',
size: 400
}
],
files: files // file-object
};
const optimizedRes = optimizer(reqParam).then(response => {
console.log('Final Optimized Response ', response);
});