1.0.7 • Published 2 months ago

asshuku v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Front-end Image Compression Tool.

Install

You can use any package manager you like to import asshuku.

npm install asshuku
// or
yarn add asshuku

Examples

Import asshuku where you need it

import { asshukuImage } from "asshuku";

... // other codes

const _file = await asshukuImage(file, {
    quality : 50,
    multAsshukuOptions : {
        targetSize: 500 * 1024, // 500KB
        maxRetryNum: 5, // total compress 6 times
        qualityChangeFn : (quality) => quality / 3
    }
});

Options

Base options

PropertyDescriptionTypeDefaultRequired
fileImage file witch you want to compressFiletrue
asshukuOptionsoptionsAsshukuOptions-false

AsshukuOptions

PropertyDescriptionTypeDefaultRequired
qualitycompress quality (0 ~ 100)Number80true
multAsshukuOptionsoptionsMultAsshukuOptions-false

MultAsshukuOptions

PropertyDescriptionTypeDefaultRequired
targetSizeCompressed target image size.Number-true
maxRetryNumThe maximum number of retries when the image is too large to compress to your target sizeNumber-true
qualityChangeFnHow to reduce quality. Quality will not be reduced to negative numbers. (It means the minimum quality is 0)Function(quality) => quality / 2false

Javascript Support

Only supports ES2015 or newer versions.

Others

1.0.7

2 months ago

1.0.6

2 months ago

1.0.5

2 months ago

1.0.4

2 months ago

1.0.3

2 months ago

1.0.2

2 months ago

1.0.1

2 months ago

1.0.0

2 months ago