#!/bin/sh
# for i in `ls *.jpg` ; do
for i in `find . -name "*.jpg" | sort` ; do
    width=`identify -verbose info $i 2>/dev/null | grep Geometry | sed 's/^.*Geometry:[[:space:]]*\([0-9]\+\)x.*/\1/'`
    if [ $width -gt 640 ] ; then
	echo "Resizing $i"
	convert $i -geometry 640x480 tmp.jpg
	touch -r $i tmp.jpg
	mv tmp.jpg $i
    fi
done
