1.0.3 • Published 4 years ago

image-file-optimizer v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

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);
});