A fork of the Materia GTK theme.

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

 render-asset.sh

View raw Download
text/x-shellscript • 950 B
Bourne-Again shell script, ASCII text executable
        
            
1
#!/bin/bash
2
set -ueo pipefail
3
4
FORCE_INKSCAPE="$(echo "${FORCE_INKSCAPE-False}" | tr '[:upper:]' '[:lower:]')"
5
if [[ "${FORCE_INKSCAPE}" == "true" ]]; then
6
RENDER_SVG=""
7
else
8
RENDER_SVG="$(command -v rendersvg)" || true
9
fi
10
INKSCAPE="$(command -v inkscape)" || true
11
OPTIPNG="$(command -v optipng)" || true
12
13
if [[ -n "${INKSCAPE}" ]]; then
14
if "$INKSCAPE" --help | grep -e "--export-filename" > /dev/null; then
15
EXPORT_FILE_OPTION="--export-filename"
16
elif "$INKSCAPE" --help | grep -e "--export-file" > /dev/null; then
17
EXPORT_FILE_OPTION="--export-file"
18
elif "$INKSCAPE" --help | grep -e "--export-png" > /dev/null; then
19
EXPORT_FILE_OPTION="--export-png"
20
fi
21
fi
22
23
i="$1"
24
25
echo "Rendering '$i.png'"
26
27
if [[ -n "${RENDER_SVG}" ]]; then
28
"$RENDER_SVG" --dpi 96 "$i.svg" "$i.png"
29
else
30
"$INKSCAPE" --export-dpi=96 "$EXPORT_FILE_OPTION=$i.png" "$i.svg" >/dev/null
31
fi
32
33
if [[ -n "${OPTIPNG}" ]]; then
34
"$OPTIPNG" -o7 --quiet "$i.png"
35
fi
36