1#!/bin/bash
2# Use this script to build typical iconsized PNGs based on a svg sourcefile.
3# ----------------------------------------------------------------------------
4# Written by Heinz-M. Graesing <heinz-m.graesing@obviously-nice.de>
5# (C) 2012-2020 Heinz-M. Graesing GNU GPL v2.0+
6# Last updated on: Dec/01/2012 by Heinz-M. Graesing
7# ----------------------------------------------------------------------------
8
9usage="mksizedsymbols.sh -f sourcefile.svg"
10sizes=( 12 16 32 48 64 128 )
11
12
13counter="0"
14while getopts "f:h" options; do
15	case $options in
16	f ) if [ -f $OPTARG ] ;then
17		file=$OPTARG
18			((counter+=1))
19		fi
20		;;
21	h ) echo $usage
22		exit 0
23		;;
24	\? ) echo $usage
25		exit 1;;
26	esac
27done
28
29
30if [ -e "$file" ];then
31	for i in "${sizes[@]}"
32		do
33			echo $i
34		inkscape --without-gui --export-area-page --export-width=$i --export-height=$i  --file=$file --export-png=${file%.*}-$i.png
35		done
36	exit 0
37else
38	echo $usage
39	exit 1
40fi
41
42