#/bin/bash
# Script for 13cm x 18cm photos

WIDTH=2460
HEIGHT=1600

X_SHAVE=20
Y_SHAVE=50
BORDER=10


# shave, convert then mogrify
for i in *.jpg ; do	
	echo Passando a regua na tal da foto `basename $i .jpg`;
	mogrify -shave ${X_SHAVE}x${Y_SHAVE} $i

	echo Gerando parte inferior
	convert $i -crop ${WIDTH}x${HEIGHT}+0+1600 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`b.jpg;

	echo Gerando parte superior
	convert $i -crop ${WIDTH}x${HEIGHT}+0+0 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`a.jpg;

	rm $i
done

echo 
echo TUDO ESTRAGADO - vai pastar
echo 
