Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The author's tool is excellent and achieves impressive ratios.

But once you open the "I can accept information loss" door, it might be worthwhile to experiment with other image manipulations also. For example, consider dropping color depth. Some images survive that process well.

Here's a 1-minute experiment... take the lenna.png image from the article... open in GIMP, posterize to 27 levels (or whatever you think is acceptable), export back to PNG... 43% savings.



That's the second option in the article (pngquant2).

Last time I checked GIMP's palette generation wasn't very good - it supported only binary transparency and truncated bits unnecessarily.

I've wanted to replace GIMP's old algorithm, but haven't even managed to compile all the prerequisites for the monstrous codebase :(

One more thing I do in pngquant2 and haven't seen it done anywhere else is dithering only areas that need it, rather than dithering entire image. This minimizes noise added and makes files look and compress better.


Also worthwhile to explore other image formats, of course.

For photos (like lenna.png), jpg is nearly always a better choice if you're ok with lossless, even better than png with the tricks mentioned in the article.

Of course there are some situations where png simply has features you want, like an alpha-channel, but some people even work around that (eg. in some videogames) by encoding the image part as jpg and a separate 8-bit alpha map in a lossless format to go with it and these are merged back together at load time. Not really suitable for the web, though (possible, but wildly inefficient compared to just letting the browser do the compositing).




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

Search: