#!/bin/sh THUMB_DIR=thumb HEIGHT=100 if [ -d $THUMB_DIR ]; then rm -f $THUMB_DIR/* else mkdir $THUMB_DIR || exit 1 fi scalecmd="pnmscale -ysize $HEIGHT" exec 2>/dev/null for f in *; do [ -f "$f" ] || continue case "$f" in *.[Jj][Pp][Gg] | *.[Jj][Pp][Ee][Gg]) djpeg "$f" | $scalecmd | cjpeg >"$THUMB_DIR/$f";; *.[Gg][Ii][Ff]) giftoppm "$f" | $scalecmd | ppmquant 256 | ppmtogif >"$THUMB_DIR/$f";; *) continue;; esac done .