PNG optimization tools
I'm currently experimenting with different tools for optimizing PNG images to figure out strengths/weaknesses of each. Only considering free, ideally open-source, tools that can be run from the command line. For smush.it I just picked pngcrush for no particluar reason and I was thinking that once I have the optimization tool up and running and get the point across that images can be optimized with no human intervention as part of the normal "push" process... then the actual behind-the-scenes png optimizer can be tweaked without affecting the overall workflow.
So, I'm considering these PNG optimizers:
- pngcrush
- optipng
- advpng
- pngout (closed source)
- pngrewrite (only for PNG8)
Can you think of any other PNG optimizers out there? Please comment.
Well, I just came back from a cruise with no internet access ($1/minute is unacceptable!) so I used my laptop's idle time to run some of the tools on a bunch of files (well over 10 000 PNG files, smartly collected right before the cruise
).
So far some (very preliminary!) results from running the tools.
- pngcrush's
-bruteoption is slower, as expected and usually doesn't help much - pngcrush with
-rem alla(strip all chunks only keeping the transparency chunk) doesn't get much better than-rem none(keep all chunks, even useless ones) - pngout seems to give the best results, but it's probably the slowest
- pngrewrite is only for pallete PNGs (PNG8), it also seems to convert truecolor PNGs with less than 256 colors to PNG8
Again, these are very preliminary and again, please let me know if you know of any other PNG optimizers.
And keep an eye on the YUIblog's img opt series for more detailed report of the results.
This entry was posted on Monday, December 22nd, 2008 and is filed under images, performance. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

December 22nd, 2008 at 10:08 pm
Don’t forget pngquant: http://www.libpng.org/pub/png/apps/pngquant.html
December 22nd, 2008 at 10:21 pm
[...] Random Feed wrote an interesting post today onHere’s a quick excerptI’m currently experimenting with different tools for optimizing PNG images to figure out strengths/weaknesses of each. Only considering free, ideally open-source, tools that can be run from the command line. For smush.it I just picked pngcrush for no particluar reason and I was thinking that once I have the optimization tool up and running and get the point across that images can be optimized with no human intervention as part of the normal “push” process… then the actual behind-the-scenes pn [...]
December 22nd, 2008 at 10:57 pm
I’ve had the best results most consistently by running PNGs through pngout and then doing a second pass through optipng.
December 22nd, 2008 at 11:19 pm
Ryan, I didn’t think pngquant (and pngnq) are in the category of general purpose PNG optimizers, their purpose is to convert truecolor PNGs (with any # of colors) to palette PNG. But I may be wrong…
December 23rd, 2008 at 12:00 am
pngquant optimizes as well as quantizing truecolor PNGs to palette PNGs. If you give it a palette PNG, it’ll just optimize it; if you give it a truecolor PNG, it’ll convert it to palette, then optimize it. In my experience, pngquant is pretty competitive with tools like pngcrush and optipng.
December 23rd, 2008 at 12:45 pm
sweet, thanks, will include it in the experiments
December 27th, 2008 at 3:15 pm
You may want to have a look at PNGNQ.
January 10th, 2009 at 2:52 am
lololol
what noobs at png compression, especially when most of the programs have been around for sooo long
Do you guys know anything?
http://pngnq.sourceforge.net/ to change it to 256 or less colors
http://entropymine.com/jason/pngrewrite/ to optimize paletted images
here is the set that does the brunt of work
http://pmt.sourceforge.net/pngcrush/ pngcrush
http://advsys.net/ken/utils.htm pngout
http://optipng.sourceforge.net/ optipng
http://psydk.org/PngOptimizer.php pngoptimizer WHICH IS OPEN SOURCE, AND YES DOES ACTUALLY HELP ON TOP OF THE OTHERS, don’t be stuck up faggots, I have run intense testing
and to squeek out a little more
http://www.walbeehm.com/download/ deflopt
http://advancemame.sourceforge.net/comp-download.html advpng/advcomp
combos of any of these work better than any single one, and can achieve faster results than ‘heavy/brute’ methods in any SINGLE one
Also, I’m not saying I deeply understand pngs, but idk why but order does matter, I made my own png compressor using these other ones, it’s just a batch script with the right options but the order mattered
If you want best compression and don’t care about time: http://www.jonof.id.au/forum/index.php?topic=846.45 pngslim
although I got mine to do the same or be off only around 0-20bytes diff and pngslim takes 4-25 times longer than mine
Seriously if some skiddy online can do it, why can’t some serious programmers that can probably actually understand zlib and libpng by code instead of just by word and made up ideas?
January 10th, 2009 at 10:11 am
Stoyan there used to be one called ‘gifwizard’ that you could upload to in the 90s. I don’t know what happened to it but the site is now going to something new. I had a look for you but couldn’t find it. However I did find something that was apparently better than it. Quote “InterGif seems to optimise 1%-7% better than GIF Wizard and 11%-34% better than websitegarage.”
Here is the link for InterGif http://www.chaos.org.uk/~pdh/software/intergif.htm
Also is there a limit to the amount of images that smushit can do at once? For some reason, it leaves out images that have been attributed to buttons such as search buttons or submit buttons?
January 10th, 2009 at 5:28 pm
Seriously though, if you’re going to do something, do it right. Apply enough research instead of doing ‘good enough’ and stroking your e-peen. Believe me you have alot more work you can do. People that don’t even understand how to program or what to do when they’re missing a dll can do a better job at optimizing images than you ( case in point http://graphicsoptimization.com/ this guy doesn’t know what to do when there’s a missing dll but by god, he knows how to optimize and do it well).
It’s not even a case of it taking too long either, it’s better to use a different program(not imagemagick) to go from gif to png. I refuse to help more than I already have because I don’t think I’d see any credit coming my or anyone else’s way. The only hints I’ll give is try different programs in different orders, you can have a process that still takes a fraction of the time of large process but can get about 10% smaller files.
Work smarter, not arrogant unknowing. If a kid can do somethin in 3 months what took the pngslim guy and the ruby png optimizer guys years I think a ‘legit’ programmer like yourself can do much better.
Hell you should be looking into the open source code cause most of these are and just making a new png optimizer from the ground up using the best methods and ideas from each. duh
Comment back if you want to talk, the e-mail i listed is spammed to hell and back so I won’t be able to see anything you send
January 10th, 2009 at 5:29 pm
also let my original post through
censorship is dumb
January 11th, 2009 at 12:53 am
Thanks Sitelab, I haven’t heard of that one, will give it a shot, thanks!
lolol, sorry your post didn’t make it through initially, wordpress holds for moderation anything with more than 2 links, I believe. Thanks for the list and the tips, I appreciate it. I did find pngslim (incidentally via a post on graphicsoptimization.com) and have been giving it a some time, looks pretty good, albeit really slow. I don’t think I’ll have the time to start a fresh new PNG opt project, seems like the existing ones are already pretty good and it’s just a question of picking which ones to run depending on “less runtime vs. best results” constraints.
January 11th, 2009 at 7:07 am
I realised after I posted that it was for gif and not PNG. Sorry!
January 11th, 2009 at 12:25 pm
Sitelab, it’s still appreciated, gifs are next on my agenda for experimentation
January 12th, 2009 at 11:09 am
[...] 其他压缩工具还有:pngout , optipng , advpng , pngrewrite 。强烈推荐一下pngout,它总能给我带来惊喜,比如一个用pngcrush压缩过的图片(32k),用pngout压缩后还可以在干掉5k!关于这些工具的性能介绍可以阅读 Stoyan Stefanov的另一篇文章PNG optimization tools [...]
January 19th, 2009 at 11:15 pm
hey Stoyan
just to let you know, png is actually most always smaller than gif I’ve found
or at least turning gifs into optimized pngs makes them smaller with no quality loss
only good time to keep a gif a gif, is when it’s really tiny like in the range of 25×25 area
March 6th, 2009 at 3:39 pm
png optimization tools with a script : http://www.css-ig.net/scriptpng
July 28th, 2009 at 3:16 pm
Pngout is powerful if you do hundreds of trials with it using different switches. There’s a shell script out there called pngslim which is perhaps the most powerful png optimization tool available.
http://graphicsoptimization.com/blog/?p=7
July 28th, 2009 at 11:16 pm
Thanks Zerb, absolutely, PNGSlim rocks for hardcore PNG optimization
July 31st, 2009 at 5:47 pm
***lolol Says: January 10th, 2009 at 5:28 pm
(case in point http://graphicsoptimization.com/ this guy doesn’t know what to do when there’s a missing dll but by god, he knows how to optimize and do it well).***
Ha! Yes, I am only about 1-2 steps above “idiot” status when it comes to the programming side of the house. However, put the right, good tools in my hands and I can generally turn just about anything into a flying tin-can in someone’s web site or GUI (without sacrificing image quality). That’s the thing that amazes me about image optimization. It’s so EASY to do, yet 95+ percent of people out there don’t do it…or think that “save for web” out of Adobe products is the end-all, be-all.
I’ll leave you with my favorite quote of all-time: “We’re all experts and we’re all idiots…it just depends upon what is being discussed at any given point in time.” Missing DLLs? Idiot. Stripping bits/bytes out of bloated image files? Working my way towards “expert” as best I can.
– Derek
April 13th, 2010 at 10:01 am
Hello, just a quick note, i do get very very good results with : http://psydk.org/PngOptimizer.php, give it a try, just got better results than pngout with standard options
June 1st, 2010 at 12:35 pm
@Vincent: PngOptimizerCL (the command line version of PngOptimizer) is included with pngslim.
In my experience, pngslim optimizes the best, nearly all the time, but it’s horribly slow.
ScriptPNG comes very close to pngslim’s compression, but it’s MUCH faster.
The latest version of ScriptPNG was released 2010-03-24.
Two advantages that ScriptPNG has over pngslim are:
1) it can convert other image file types (bmp, gif, tga, pcs, tif, etc.) to png
2) it lets you choose from a) fast lossless optimization b) complete lossless optimization c) conversion to paletted PNG without diffusion d) convert to paletted PNG with Floyd-Steinberg diffusion (using pngnq).
One LARGE disadvantage to ScriptPNG is that the files must reside in the same folder as the script, so you can’t just highlight multiple files and drag and drop them onto the script.
I’ve been thinking of splitting up the ScriptPNG into 4 scripts (one for each current option) and incorporating drag-n-drop, a la pngslim.
Usually, I don’t have a pressing time constraint, so I am OK with letting pngslim work in the background on the file(s) I drop onto it. However, it would be nice to get ScriptPNG working in the same manner.
June 30th, 2010 at 1:42 pm
@earthsound : new version of ScriptPNG (2010.03.24 New) is available. Move or copy the ScriptPNG to folder you want, and execute options.
December 5th, 2010 at 4:51 am
[...] A wide variety of PNG optimization tools which you can run from the command line exist. In the example, I’ve chosen to use OptiPng, but as you will see you can very easily swap it out for a different tool if you desire. Stoyan Stefanov has already done an excellent job outlining how to install each of these optimization tools, so I will simply refer you to his article for installation instructions. [...]
January 23rd, 2012 at 8:34 am
Hello, i’ve found another tool on this website. According to my tests on a lot of pictures, pngxoptimizer was the faster tool and also the better : http://www.css-ig.net/pngxoptimizer.html and it’s free!