Batch conversion of PNG32 images to PNG8

grinder
In an effort to better support IE6, I have converted my copy of the famfamfam icon library from PNG32 images into PNG8 images. Here is how…

I initially tried using ImageMagick, but it would not bend to my will. However, a handy forum post pointed me to a linux binary of the pngout utility.

You can use pngout to convert PNG32 to PNG8 as follows:

pngout-linux-i686 -c3 -d8 -y -force

“-c3″ tells pngout to use a colour palette, “-d8″ specified an 8-bit colour depth, and “-force” ensures the conversion is done even if the output file size is larger.

To convert the entire famfamfam icon library I ran the following:

mkdir famfamfam-8bit
cd famfamfam
find . -name '*.png' -exec /root/pngout-linux-i686 -c3 -d8 -y -force {} ../famfamfam-8bit/{} \;

I ran these on a 32-bit CentOS 5 box running under VMWare.

2 comments so far

  1. Brad on

    Short. Effective.

  2. Sneakers Blog on

    Good one! I used it for one of my projects.


Leave a reply