img-about
pkg.module supported
, which means that you can apply tree-shaking in you project
A module for image deal, includes getting naturalSize, minifying in browser
repository
https://github.com/livelybone/img-about.git
Demo
https://livelybone.github.io/tool/img-about
Installation
npm i -S img-about
Global name
ImgAbout
Usage
import {getNaturalSize, imgMinify} from 'img-about';
when you want to set this module as external while you are developing another module, you should import it like this:
import * as ImgAbout from 'img-about'
Use in html, see what your can use in CDN: unpkg
<-- use what you want -->
<script src="https://unpkg.com/img-about/lib/umd/<--module-->.js"></script>
Functions
getNaturalSize
(url: [String, Image]) => Promise<Object: {width, height}>
imgMinify
(imgFile: [File, Blob], minifyOptions: MinifyOptions) => Promise<[Blob, String]>
var compressTypes = ['scale', 'fixedWidth', 'fixedHeight', 'fixedSize']
const MinifyOptions = {
compressType: 'scale',
scale: 1,
width: 0,
height: 0,
size: 0,
quality: .8,
toBlob: true,
}