image-file-compress
v2.1.0
Published
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.
Downloads
13
Maintainers
Readme
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 frominput[type='file']
, etc.