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-09 12:32:09 +02:00
|
|
|
|
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}'"
|
2018-08-09 15:16:31 +02:00
|
|
|
if [[ "${OPTION_GTK2_HIDPI:-false}" != "true" ]]; then
|
2018-08-09 12:32:09 +02:00
|
|
|
"$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 \
|
2018-08-09 12:32:09 +02:00
|
|
|
--export-png="${result_file}" "$SRC_FILE" >/dev/null
|
2018-08-05 02:42:22 +02:00
|
|
|
fi
|
2018-08-09 12:32:09 +02:00
|
|
|
"$OPTIPNG" -o7 --quiet "${result_file}"
|
2018-08-05 02:42:22 +02:00
|
|
|
fi
|