Arc-39-theme/common/gtk-2.0/render-asset.sh

30 lines
655 B
Bash
Raw Normal View History

2018-08-05 02:42:22 +02:00
#!/bin/bash
set -ueo pipefail
INKSCAPE="$(which inkscape)"
OPTIPNG="$(which optipng)"
ASSETS_DIR="$1"
SRC_FILE="${ASSETS_DIR}".svg
i="$2"
2018-08-05 02:42:22 +02:00
result_file="$ASSETS_DIR/$i.png"
if [[ -f "${result_file}" ]] ; then
echo "${result_file} already exists."
else
echo "Rendering '${result_file}'"
if [[ "${OPTION_GTK2_HIDPI:-false}" != "true" ]]; then
"$INKSCAPE" --export-id="$i" \
--export-id-only \
--export-png="${result_file}" "$SRC_FILE" >/dev/null
2018-08-05 02:42:22 +02:00
else
"$INKSCAPE" --export-id="$i" \
--export-id-only \
--export-dpi=192 \
--export-png="${result_file}" "$SRC_FILE" >/dev/null
2018-08-05 02:42:22 +02:00
fi
"$OPTIPNG" -o7 --quiet "${result_file}"
2018-08-05 02:42:22 +02:00
fi