1.0.4 • Published 2 months ago

weimgcompress v1.0.4

Weekly downloads
1
License
ISC
Repository
github
Last release
2 months ago

weimgcompress

中文

npm npm bundle size npm GitHub

install

npm install weimgcompress
# common JS
const weimgcompress = require('weimgcompress')
# es6
import weimgcompress from 'weimgcompress'

use

// compress img, return base64
console.log(weimgcompress.compress(imgObj, quality))
// download compressed img
console.log(weimgcompress.downloadImg(imgObj, name, quality))

function

functionparameterdefaultrequireddescription
compressobjectrequireda img object
compressnumber1optionala float between 0 and 1
downloadImgobjectrequireda img object
downloadImgstringrequiredname for save new img
downloadImgnumber1optionala float between 0 and 1

tips

A Number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp.

wiki

  1. HTMLCanvasElement.toDataURL()
1.0.4

2 months ago

1.0.3

2 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago