#!/bin/sh SRC=$1 BASE=`echo $SRC | sed 's/\.[^.]*$//'` pngtopnm -background '#ffffff' $SRC > $BASE.ppm pngtopnm -alpha $SRC > $BASE-mask.pgm LAYERS="" while read SIZE COLORS do pnmscale -xysize $SIZE $SIZE $BASE.ppm | ppmquant $COLORS > $BASE-$SIZE.ppm 2>/dev/null pnmscale -xysize $SIZE $SIZE $BASE-mask.pgm > $BASE-$SIZE-mask.pgm LAYERS="$LAYERS $BASE-$SIZE.ppm $BASE-$SIZE-mask.pgm" done <<'EOF' 16 16 32 16 48 256 EOF ppmtowinicon -andpgms $LAYERS > $BASE-favicon.ico