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-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null #\
19
# && $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
20
fi
21
if [ -f $ASSETS_DIR/$i@2.png ]; then
22
echo $ASSETS_DIR/$i@2.png exists.
23
else
24
echo
25
echo Rendering $ASSETS_DIR/$i@2.png
26
$INKSCAPE --export-id=$i \
27
--export-dpi=192 \
28
--export-id-only \
29
--export-png=$ASSETS_DIR/$i@2.png $SRC_FILE >/dev/null #\
30
# && $OPTIPNG -o7 --quiet $ASSETS_DIR/$i@2.png
31
fi
32
33
exit 0
34