#!/bin/bash

########
# Author: David Cannings <david@edeca.net>
#   Date: 21/09/04
#    Use: ./SVGtoPNG <height>
# 
# This script requires the tools inkscape and pngrewrite
# to be installed.
#
# This script uses inkscape to convert SVG files to PNG
# files.  It was designed for use with with the Nautical
# Flags game, to convert the SVG flags into a usable 
# format.
########

[ -z "$1" ] && { 
	echo "Use: ./SVGtoPNG <height>"
	exit 1
}

rm -rf *.png

for file in *.svg; do
	name=`basename $file '.svg'`
	inkscape --without-gui --export-png=${name}.png --export-height=${1} \
		--export-area=4.5:4.5:45.5:45.5 --export-background=white ${file}
	pngrewrite ${name}.png ${name}.png >/dev/null 2>&1
done
