image-file-compress

2.1.0 • Public • Published

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.

Package Sidebar

Install

npm i image-file-compress

Weekly Downloads

3

Version

2.1.0

License

ISC

Unpacked Size

10.1 kB

Total Files

6

Last publish

Collaborators

  • kbdsbx