4 # We process all of the xpm files in ~/icons, reducing their collective
5 # colourmap, and producing files in ~/tmp-icons.
7 # Make a note of those files with transparent bits for zapping afterwards:
8 # this isn't perfect, but seems to work OK for the pixmaps that I use.
10 # Notice that the input, output, and number of colours are hardwired.
12 # (The ppmtogif | giftoppm is to make sure the ppm file is in raw format, because
13 # ppmquant appears not to work with the result of xpmtoppm!)
15 echo Converting files to ppm format
17 for i
in ..
/icons
/*.xpm
20 sed 's/[Nn]one/black/g' $i | xpmtoppm | ppmtogif | giftoppm
> `basename $i .xpm`.ppm
21 if test -s `basename $i .xpm`.ppm
25 NONE
="$NONE `basename $i`"
28 rm -f `basename $i .xpm`.ppm
32 echo Performing quantization to
32 colours
35 echo Converting to xpm format again
39 ppmtoxpm
$i > `basename $i .ppm`.xpm
43 echo Trying to fix transparent pixels
in some files
47 sed 's/` c #000000/` c None/' $i > $i-tmp.xpm