Skip to content

Why using CMD Batch?

yumeyao edited this page Nov 15, 2013 · 2 revisions

####Why CMD Batch is preferable to other script languages? The optimizing process mainly relies on existing toolsPNGOut and Zopflipng(Why?). This Project is just a SMART wrapper script for the tools and it only operate at file-level. Therefore CMD Batch satisfies the task very well. The advanced facilities provided by python/ruby, or even powershell/vbscript just don't make it coding easier. So as CMD Batch is 'native' on Windows, there is no reason for the (general) users to download a python/ruby interpreter just for running this script.

Yes CMD Batch is not portable. But it's possible (and easy) to translate it into another shell.

Yes CMD Batch sucks because (when compared to *nix shell script) it lacks feature A/B/C/.... But many of the features can be achieved via a workaround(coding skill, nuh?).

####Why windows? Why not Linux? As discussed well in this page, only PNGOut and Zopflipng is necessary to finish the job. Other tools such like pngcrush/optipng/advpng are useless.

But unfortunately, PNGOut is only available in public as a Windows binary. That makes this particular script is suitable for Windows.

So in particular, if you use Linux and you can't find a copy of pngout binary for Linux, you can use Zopflipng and that's enough. Use zopflipng --filters=01234mepb --splitting=3 as explained in zopflipng usage. If you want it to run faster, you can first run zopflipng -q --filters=01234mepb --splitting=3, then removing the filters that is significantly bad for a certain file by analyzing the text output(log) and second run zopflipng --filters=xxxxx(bad filters removed) --splitting=3. Note you don't need pngcrush/optipng/advpng. They are useless. If you don't believe the fact, just go and try.

If you use Mac OS X, you can go with ImageOptim. If you can't bear its brute way and want a smart way, you can study this script and use the pngout/zopflipng binaries inside the ImageOptim package and run them in a similar way.