2 Star 2 Fork 0

GLUESTICK / img-compressor

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

simplify-img-compressor

图片压缩

使用方法

npm install simplify-img-compressor --save-dev

引入

import $imgCompressor from 'simplify-img-compressor'

压缩

$imgCompressor.(file[,maxImgLength,quality]).then((res)=>{
    // Do something
});

参数说明:

  • file:图片文件对象
  • maxImgLength:图片最大长度 (类型:数字 默认:1200)
  • quality:压缩质量 (类型:数字 范围:0-1 默认:0.6)

返回参数:

  • name:文件名称
  • maxImgLength:图片最大长度
  • quality:压缩质量
  • afterCompressorSize:压缩后大小
  • beforeCompressorSize:压缩前大小
  • file:压缩后文件对象,类型:blob
  • dataURL:压缩后文件的DataURL

Comments ( 0 )

Sign in for post a comment

About

Cancel

Releases

No release

img-compressor

Contributors

All

Activities

load more
can not load any more
JavaScript
1
https://gitee.com/GLUESTICK/img-compressor.git
git@gitee.com:GLUESTICK/img-compressor.git
GLUESTICK
img-compressor
img-compressor
master

Search