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 • 801 B
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
if [[ -n "${INKSCAPE}" ]]; then
9
if "$INKSCAPE" --help | grep -e "--export-filename" > /dev/null; then
10
EXPORT_FILE_OPTION="--export-filename"
11
elif "$INKSCAPE" --help | grep -e "--export-file" > /dev/null; then
12
EXPORT_FILE_OPTION="--export-file"
13
elif "$INKSCAPE" --help | grep -e "--export-png" > /dev/null; then
14
EXPORT_FILE_OPTION="--export-png"
15
fi
16
fi
17
18
i="$1"
19
20
echo "Rendering '$i.png'"
21
22
if [[ -n "${RENDER_SVG}" ]]; then
23
"$RENDER_SVG" --dpi 96 "$i.svg" "$i.png"
24
else
25
"$INKSCAPE" --export-dpi=96 "$EXPORT_FILE_OPTION"="$i.png" "$i.svg" >/dev/null
26
fi
27
28
if [[ -n "${OPTIPNG}" ]]; then
29
"$OPTIPNG" -o7 --quiet "$i.png"
30
fi
31