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.
I am trying to compress the PNG image using
imagemin
andimagemin-pngquant
, after applying the transformation with different quality level, getting different sizes of imageSee for quality between
0, 1 => 1848433
. and for quality between0, 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: