#!/bin/sh
#
# convert an svg file into the useful png icon sizes: 12, 16 and 24px
#
# Parameter: input_file.svg output_prefix
#
# Copyright:	2010 by Lars Kruse <devel@sumpfralle.de>
# License:	GNU GPL v3 or higher (http://www.gnu.org/licenses/gpl-3.0.txt)
#

set -eu

CONVERTER=inkscape
SIZES="12 24 32 40"


test $# -ne 2 && echo >&2 "Invalid number of arguments: I expected exactly two" && exit 1

in_file="$1"
out_prefix="$2"

test ! -e "$1" && echo >&2 "File not found: $1" && exit 2

# conversion
for size in $SIZES
  do	inkscape --without-gui --export-area-drawing \
			--export-height="$size" --export-width="$size" \
			--export-png="${out_prefix}_${size}.png" "$in_file"
 done