#/bin/bash
# Script for automatic trim scanned images

ext="jpg"

for i in *.$ext ; do	
	echo Detectando bordas... figura `basename $i .$ext`;
	mogrify -crop \
      `convert $i -blur 0x4 -fuzz 10% -trim -format '%wx%h%O' info:` \
      +repage $i
done

