Image Compression Tool Uses the Browser's native canvas.toBlob API to do the compression work, which means it is lossy compression, asynchronous, and has different compression effects in different browsers. Generally use this to precompress a image on the client side before uploading it.
The quality of the output image. It must be a number between 0
and 1
. If this argument is anything else, the default values 0.92
and 0.80
are used for image/jpeg
and image/webp
respectively. Other arguments are ignored. Be careful to use 1
as it may make the size of the output image become larger.
Examples:
Quality | Input size | Output size | Compression ratio | Description |
---|---|---|---|---|
0 | 2.12 MB | 114.61 KB | 94.72% | - |
0.2 | 2.12 MB | 349.57 KB | 83.90% | - |
0.4 | 2.12 MB | 517.10 KB | 76.18% | - |
0.6 | 2.12 MB | 694.99 KB | 67.99% | Recommend |
0.8 | 2.12 MB | 1.14 MB | 46.41% | Recommend |
1 | 2.12 MB | 2.12 MB | 0% | Not recommend |
NaN | 2.12 MB | 2.01 MB | 5.02% | - |