1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/bin/sh
while getopts 'v' c
do
case $c in
v) set -x ;;
esac
done
shift $(($OPTIND - 1))
# FIXME: Sometimes, compare fails when comparing very small images (e.g. 40 x 10 pixels).
# It's unknown why this happens..
pixelerror=`compare -fuzz 10% -metric AE $1 $2 null: 2>&1`
if [ $? -ne 0 ]; then
echo "General error: Ouch"
exit 1 # Compare failed to read image
else
# Check if $pixelerror contains an integer (it sometimes outputs things like '0 @ 0,0')
if [ $pixelerror -eq $pixelerror 2> /dev/null ]; then
if [ $pixelerror == 0 ]; then
exit 0
fi
echo "Pixel error: $pixelerror"
else
echo "Pixel error: Err"
fi
exit 1
fi
exit 0
|