render-asset.sh
Bourne-Again shell script, ASCII text executable
1
#! /bin/bash
2
3
INKSCAPE="/usr/bin/inkscape"
4
OPTIPNG="/usr/bin/optipng"
5
6
SRC_FILE="assets.svg"
7
ASSETS_DIR="assets"
8
9
i=${1}
10
11
if [ -f $ASSETS_DIR/$i.png ]; then
12
echo $ASSETS_DIR/$i.png exists.
13
else
14
echo
15
echo Rendering $ASSETS_DIR/$i.png
16
$INKSCAPE --export-id=$i \
17
--export-id-only \
18
--export-background-opacity=0 \
19
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
20
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
21
fi
22
23
exit 0
24