png8 is a commandline tool for OS X that converts 24-bit PNG images to 8-bit PNG. Most common graphic programs can't export to 8-bit PNG with alpha transparency even though it's by far the most useful file format for the web.
Further reading on the advantages of 8-bit PNG:
- Uses two different converters (pngquant and pngnq) with sane defaults and options.
- Converts several files at once and ignores files that already are 8-bit PNG.
- Preview different alternatives and choose the best one (interactive mode).
- Uses pngout if available to further reduce file size.
curl https://raw.githubusercontent.com/perifer/png8/master/png8 >> /usr/local/bin/png8 && chmod u+x /usr/local/bin/png8
Download and install dependencies manually:
Or install with homebrew:
brew install pngquant brew install pngnq brew install jonof/kenutils/pngout
Convert file.png with pngquant and create a backup of the original file:
Skip backup (Overwrite) and convert all PNGs in a specific directory. 8-bit PNGs in the same directory are ignored:
png8 -O images/*.png
Preview different alternatives (interactive) and save to directory "img":
png8 -i file.png -d img
List all options: