render-asset.sh
Bourne-Again shell script, ASCII text executable
1
#!/bin/bash
2
set -ueo pipefail
3
4
RENDER_SVG="$(command -v rendersvg)" || true
5
INKSCAPE="$(command -v inkscape)" || true
6
OPTIPNG="$(command -v optipng)" || true
7
8
i="$1"
9
10
echo "Rendering '$i.png'"
11
if [[ -n "${RENDER_SVG}" ]] ; then
12
"$RENDER_SVG" --dpi 96 "$i.svg" "$i.png"
13
else
14
"$INKSCAPE" --export-dpi=96 --export-png="$i.png" "$i.svg" >/dev/null
15
fi
16
17
if [[ -n "${OPTIPNG}" ]] ; then
18
"$OPTIPNG" -o7 --quiet "$i.png"
19
fi
20