# This is a crippled X.Gang script to break a gif photo into half...

# ImageMagick is used to do it.
# gifsicle to make it stop blinking ...

max=25

for i in `find -type d -maxdepth 1` ; do
    echo "now $i"
    p=0
    while [ $p != "25" ] ; do
	p=$(($p+1))
	file="./$i/$p.gif"
	half="./$i/h.$p.gif"
	size=`(identify -verbose '%x:%y' $file| grep -i 'geometry:' | grep -iv page | awk '{print $2}') 2>/dev/null`
	sizex=`echo $size | awk -F x '{print $1}'`
	sizey=`echo $size | awk -F x '{print $2}'`
	xp=`expr $sizex / 2`
	yp=$sizey    
	echo "original $file : $sizex x $sizey"
	echo "half $half : $xp x $yp"
	convert -crop "$xp x $yp" $file $half
	gifsicle $half  --no-loopcount > test
	mv test $half
    done
done
