#!/bin/sh

size=128x96

if [ $1 = "-s" ]; then
	shift
	size=$1
	shift
fi

infile="$1"
outfile="$2"

tmppng=$(mktemp /tmp/grace-thumbnail-XXXXXX)

gracebat -hdevice PNG -printfile $tmppng "$infile"
convert -resize $size -sharpen 4 $tmppng "$outfile"
rm -f $tmppng
