2.1.0 • Published 5 years ago

image-file-compress v2.1.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Image File Compress

Minifiy and cut down image in the browser when it is so large. Then it will solve that image uploads by iOS is rotated with gyroscope.

Install

npm install image-file-compress --save

Usage

import compress from 'image-file-compress';
compress( '[src]', {
    rotate : true,
    zoom: true,
    max_width: 800,
    max_height: 600,
    output_type : 'image/jpg',
} )
.then( res => {
    // res.path : <base64>
    // res.data : <blob>
} );

or just only:

compress( '[src]', {
    max_width: 800,
} ).then( <then> );
  • The [src] use string as URL or File object from input[type='file'], etc.