Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ngnq is a tool for quantizing PNG images using neuquant algorithm. (sourceforge.net)
20 points by MikeCapone on May 16, 2010 | hide | past | favorite | 8 comments



Few benchmarks using Cmd+4'd of my working Firefox window.

Tested with:

  pngnq -n 256 image.png
  optipng -o7 image.png
  advpng -z4 image.png
  pngout image.png
Results:

  312822  test-firefox.png
  181394  test-firefox-advpng.png
  199005  test-firefox-optipng.png
  235635  test-firefox-pngout.png
  181394  test-firefox-full.png
  
   79793  test-firefox-nq8.png
   74917  test-firefox-nq8-advpng.png
   79683  test-firefox-nq8-optipng.png
   76017  test-firefox-nq8-pngout.png
   74917  test-firefox-nq8-full.png
Samples:

   Original   http://gridth.s3.amazonaws.com/test-firefox.png
   Quantized  http://gridth.s3.amazonaws.com/test-firefox-nq8.png
The result file size is impressive, but the image quality is noticeably worse. I'm not sure if I want to use color quantization with PNG though. After all, if I want a lossy compression, I'd use JPEG.


This is exactly what I don't understand about the existence of this program. I don't know much about compression algorithms, but this is definitely lossy compression. I don't know why somebody would want to use it on their lossless PNGs when JPG already exists.


PNG8 allows you to use alpha in palettized form. Images you want to use in a "composite" context(icons, buttons, sprites, etc.) really need alpha to look great, but you don't usually need the full color gamut for them either.


You want to use it when you don’t want any ugly JPG compression artifacts to show up. PNG and JPG produce different compression artifacts, depending on what you are compressing either one could look better.



Only place it's noticeable is the header of the page. I wonder if it's the only place where it save bits, or if it saves some in the rest too. If it does, that seems like the kind of graphic you'd want to use it with.


I think it's a fantastic result. Very useful for including screenshots in blog posts without sacrificing too much quality, but clearly decreasing size.


This is a great tool, I used it to palettize spritesheets for my last game. Caveat: it sometimes palettized the 0-alpha values to 1, resulting in a very faint box around affected images.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: