I've been using pngnq for a while, and the results are really impressive. It compresses a lot and keeps quality and transparency of any PNG file.

So I've noticed people talking about pngquant, which has been improved recently. It uses a different algorithm than pngnq. It's a little slower, but the results are pretty good too.

tl;dr - pngquant may wins in some cases. pngnq is faster.

The following examples represents the output of pngquant and pngnq in images with and without transparent background.

Without transparent background

Here is Lenna's original picture. 120440 bytes:

lena original

pngnq fast & rough: 51ms, 51.1kb:

lena pngnq fast

pngnq slow: 232ms, 51.37kb. Larger filesize. Maybe better image quality:

lena pngnq slow

pngquant fast & rough: 167ms, 50.61kb:

lena pngquant fast

pngquant slow: 2781ms, 48.24kb:

lena pngquant slow

Transparent background

Here is iPhone 5 sample from Apple hotsite. 76.09kb:

iphone5 original

pngnq fast & rough: 121ms, 20.82kb:

iphone5 pngnq fast

pngnq slow: 165ms, 20.27kb:

iphone5 pngnq slow

pngquant fast & rough: 130ms, 22.63kb:

iphone5 pngquant fast

pngquant slow: 2383ms, 19.86kb:

iphone5 pngquant slow

If you need something really fast, you should go with pngnq. Which takes less time even using the "slow" configuration.

Now if you need quality no matter the cost, pngquant is for you.

Blog Logo

Endel Dreyer

Full-stack developer. Loves Ruby and JavaScript.



bugfixer / @endel

About programming, tools and solving problems.

Back to Overview