printf 'Usage: %s [-p] [-n] [-h] [image_dir]
Options:
-p .. Combine straight to PNG. Otherwise first pics are combined into a
GIF and than converted to PNG.
-n .. No action, i.e. show what would be done without actually doing it.
-h .. Print this help and exit.
Combines several images into a sprite named combined.png and prints out
the required CSS infos. E.g.:
}
GIF="gif"
ECHO=""
while getopts "h(help)n(dry)p(png)" option ; do
h) Usage ; exit 0 ;;
p) GIF="png" ;;
n) ECHO="echo" ;;
esac
done
shift $IDX
if [ -n "$1" ]; then
cd "$1"
fi
OUT="combined"
# concat to GIF (results in smaller pics than to PNG directly)
if [ "$GIF" = "gif" ]; then
# convert to PNG (transparent gifs are rendered badly by FF on none-transparent
# BGs. Converting it manually e.g. with Gimp may produce better results.)
fi
integer X=0
[ -z "$F" ] && continue
printf "%s background-position: -%dpx %dpx; width: %dpx; height: %dpx;\n" \
"$F" $X 0 $W $H
X=$((X+$W))
done