nodeca / pica

Resize image in browser with high quality and high speed

Home Page:http://nodeca.github.io/pica/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dramatic file size increase

DanielKucal opened this issue · comments

While resizing an image using this library I notice dramatic increase in the file size. I think reducing the file size is a top-goal when it comes to image downsizing. My example uses the following settings:

    quality: 3, // max
    alpha: false,
    unsharpAmount: 150,
    unsharpRadius: 1,
    unsharpThreshold: 1,

https://stackblitz.com/edit/typescript-xxfkmc?file=index.ts

I get the following results for 2322 × 4128 JPG picture weighting 2.8MB that goes through the library with the same output dimensions:
For WebP the resized file size is 10.23 MB
For JPEG the resized file size is 9.00 MB
For PNG the resized file size is 13.35 MB

Why is this happening?

You use 100% "quality" in .toBlob(), when convert resized bitmap to jpeg. That cause too big size.