#/bin/bash
# Script for 10cm x 15cm photos

#TOTAL SIZE: 2550 X 3507

L_WIDTH=1200
R_WIDTH=1280

T_HEIGHT=1750
B_HEIGHT=1720

BORDER=10


for i in *.jpg ; do
	echo Gerando parte superior esquerda... `basename $i .jpg`a...
	convert $i -crop ${L_WIDTH}x${T_HEIGHT}+15+20 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`a.jpg;

	echo Gerando parte superior direita... `basename $i .jpg`b...
	convert $i -crop ${R_WIDTH}x${T_HEIGHT}+1220+20 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`b.jpg;

	echo Gerando parte inferior esquerda... `basename $i .jpg`c...
	convert $i -crop ${L_WIDTH}x${B_HEIGHT}+15+1770 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`c.jpg;

	echo Gerando parte inferior direita... `basename $i .jpg`d...
	convert $i -crop ${R_WIDTH}x${B_HEIGHT}+1220+1770 -bordercolor white -border ${BORDER}x${BORDER} `basename $i .jpg`d.jpg;

	#rm $i
done

echo 
echo DONE
echo 
