I’ve mentioned PNGout on Waffle a couple of times over the years. It’s an unbeatable little command line tool for making PNG files smaller that exists for multiple platforms. It was originally developed for Windows but has been succesfully ported to linux and OS X.
Great though PNGOUT is, the ports don’t come with a lot of installation instructions and while linux users can just follow standard procedures for installing a precompiled binary in the right place, Mac users may find it confusing. Here’s what you have to do to make the OS X port work:
1. Install it in one of the Unix binaries directories, not in /Applications. You can use /bin or /usr/bin – either should work. Because I’m lazy, I use /bin.
2. Rename it from pngout-darwin to something shorter, or use a symlink.
This procedure is of course very different from installing a .app program on a Mac. For one, you have to do it on the command line. Open your Terminal in the Utilities folder under Applications and if you have put your pngout-darwin in Applications, type
sudo mv /Applications/pngout-darwin /bin/pngout
Hit Enter. You will be prompted for your administrator password. Type it and hit Enter again. That’s it – PNGout will now work wherever you call it from. Provided of course that you call it on the command line, which you’ve already opened.
Changing individual files is as simple as going to the directory the file is in using the
cd command and typing
pngout <sourcefile>.png <targetfile>.png, replacing the names between brackets with the real filenames you want. There’s a batch operation for linux that should work on the Mac as well. It’s
for s in *.png;do pngout* -c3 -b0 -v "$s" tmp.png && mv -f tmp.png "$s";done
This is a slightly tweaked version of the operation shown in TASVideos: How To Make PNG. For my own use, I have tweaked it more, taking out the -c3, -b0, -v parameters and telling it to output the PNG files directly into a subfolder instead of outputting each individual file to ‘tmp.png’ and renaming it later:
for s in *.png;do pngout "$s" pngout/$s;done
Back to the installation issue: I think the fact that you can’t just drop pngout-darwin in Applications is a weakness in the Mac OS X operation system: the command line interface and the GUI don’t use the same file paths for executable programs, so that using command line programs, already harder than using the GUI, comes with an unexpected pitfall. If there is a workaround for this, please let me know.