#! /bin/sh MP=false dirs=graphs style=check size=thumb; xy=128x128 filt="*" while [ $# -gt 0 ]; do case $1 in -mp) shift; MP=true ;; -dir) shift; dirs=$1; shift; ;; -plots) shift; dirs=plots ;; -roots) shift; dirs=roots ;; -graphs)shift; dirs=graphs ;; -hist) shift; dirs=hist ;; -level) shift; dirs=level ;; -search)shift; dirs=search ;; -all) shift; dirs="graphs roots hist level search" ;; -check) shift; style=check ;; -new) shift; style=new ;; -thumb) shift; size=thumb; xy=128x128 ;; -half) shift; size=half; xy=320x240 ;; [0-9][0-9]*) filt="*$1-*"; shift ;; *) echo "Bad arg: $1."; exit ;; esac done for d in $dirs; do ( # If no full size image available; skip: if [ ! -d $d ]; then echo "No $d; skipping"; continue; fi cd $d pwd if [ ! -d $size ]; then mkdir $size; fi if [ $style = new ]; then rm -f $size/*; fi files=`ls $filt.[gp][in][fg]` for f in $files; do if [ $style = check -a -s $size/$f ]; then continue; fi echo $f if [ $MP = true ]; then echo $f nice convert -geometry $xy -colors 16 -sharpen 90 $f $size/$f & else convert -geometry $xy -colors 16 -sharpen 90 $f $size/$f ; fi done ) done