kornelski / pngquant

Lossy PNG compressor — pngquant command based on libimagequant library
https://pngquant.org
Other
5.25k stars 487 forks source link

What is the default value of the parameter quality? #339

Closed martianma closed 5 years ago

martianma commented 5 years ago

What is the default value of the parameter quality? What should be set normally? 65 to 80?

kornelski commented 5 years ago

The default is 0-100, i.e. it aims for 100, but never gives up. Lowering of quality doesn't reduce file sizes much, so it's fine to use 100.

martianma commented 5 years ago

My test results are like this: --quality default 0-100 292MB -> 216MB

--quality=65-80 292MB -> 255MB

If the parameter uses 65-80, the compressed file size will be a little larger. Is this normal? Do you mean using 0-100 or 100-100?

kornelski commented 5 years ago

Relationship between quality and size is very complicated.

Sometimes fewer colors mean fewer unique details in the image, which compresses better. Sometimes lower colors lead to more dithering, which adds more noise in the image, which compresses worse.

100-100 means at minimum quality 100, and requires to give up on all images that can't be losslessly converted, which is pretty much useless.

martianma commented 5 years ago

Ok, I see, thank you