kornelski / pngquant

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

Compressed image still massive even with super low quality min/max. #309

Open datermine opened 6 years ago

datermine commented 6 years ago

I've been using pngquant successfully for sometime now, but I've noticed recently that some images are just not compressing very much.

In the below, I'm trying to compress f.png which is 3+mb, but the smallest I can get it with pngquant is 2.7mb.

I must be doing something wrong.

gmike@instance:~/projects/scratch/comp$ pngquant --version
2.5.0 (June 2015)
gmike@instance:~/projects/scratch/comp$ ls -ltr
total 6064
-rwxr-xr-x 1 gmike gmike    1658 Aug 31 18:58 compress_image_and_upload.sh
-rw-r--r-- 1 gmike gmike 3460607 Aug 31 18:58 f.png
-rw-r--r-- 1 gmike gmike 2741762 Aug 31 19:06 f.pngquant.png
gmike@instance:~/projects/scratch/comp$ pngquant -v --quality=5-20 --force --ext .pngquant.png ./f.png
./f.png:
  read 3380KB file
  made histogram...14319 colors found
  selecting colors...4%
  selecting colors...25%
  selecting colors...28%
  selecting colors...32%
  selecting colors...35%
  selecting colors...38%
  selecting colors...42%
  selecting colors...45%
  selecting colors...49%
  selecting colors...52%
  selecting colors...56%
  selecting colors...59%
  selecting colors...63%
  selecting colors...66%
  selecting colors...69%
  selecting colors...73%
  selecting colors...76%
  selecting colors...80%
  selecting colors...83%
  selecting colors...100%
  moving colormap towards local minimum
  eliminated opaque tRNS-chunk entries...0 entries transparent
  mapped image to new colors...MSE=20.650 (Q=42)
  writing 11-color image as f.pngquant.png
No errors detected while quantizing 1 image.
gmike@instance:~/projects/scratch/comp$ ls -ltr
total 6064
-rwxr-xr-x 1 gmike gmike    1658 Aug 31 18:58 compress_image_and_upload.sh
-rw-r--r-- 1 gmike gmike 3460607 Aug 31 18:58 f.png
-rw-r--r-- 1 gmike gmike 2741762 Aug 31 19:06 f.pngquant.png
kornelski commented 6 years ago

Try adding --strip to remove metadata.

If the image has lots of pixels, it may just be that big. Expect 0.5 byte per pixel.

datermine commented 6 years ago

I noticed --strip wasn't available. I'm on v2.5, but that's what I'm getting with sudo apt-get install pngquant.

Is there a better way to get v2.12