imagemin / imagemin-pngquant

Imagemin plugin for `pngquant`
MIT License
318 stars 81 forks source link

Why Image compression increases size of image? #81

Open g-abhishek opened 2 years ago

g-abhishek commented 2 years ago

I am trying to compress the PNG image using imagemin and imagemin-pngquant, after applying the transformation with different quality level, getting different sizes of image

See for quality between 0, 1 => 1848433. and for quality between 0, 0.8 => 2051244. for lower quality image size is greater than the higher quality.

e.g input size 1677003 bytes quality: [0, 0.1] => 1227453 quality: [0, 0.5] => 1662248 quality: [0, 0.7] => 1886730 quality: [0, 0.8] => 2051244 quality: [0, 0.9] => 2018915 quality: [0, 0.95] => 1995294 quality: [0, 1] => 1848433

Sample code: let res = await imagemin.buffer(buffer, { plugins: [ imageminPngquant({ quality: [0, 1], }), ], });

Sample image: 1p7

ikitty commented 2 years ago

got the same problem. cannot understand the 'quality' variable.