2022-05-05 00:11:07 +08:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
INKSCAPE="inkscape"
|
|
|
|
OPTIPNG="optipng"
|
|
|
|
|
|
|
|
SRC_FILE="assets.svg"
|
|
|
|
ASSETS_DIR="."
|
|
|
|
|
|
|
|
INDEX="assets.txt"
|
|
|
|
|
|
|
|
# check command avalibility
|
|
|
|
has_command() {
|
|
|
|
"$1" -v $1 > /dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
mkdir -p $ASSETS_DIR
|
|
|
|
|
|
|
|
for i in `cat $INDEX`
|
|
|
|
do
|
2022-05-13 18:38:41 +08:00
|
|
|
echo Rendering $ASSETS_DIR/$i.png
|
2022-05-05 00:11:07 +08:00
|
|
|
|
2022-05-13 18:38:41 +08:00
|
|
|
$INKSCAPE --export-id=$i \
|
|
|
|
--export-id-only \
|
|
|
|
--export-type=png \
|
|
|
|
-o $ASSETS_DIR/$i.png $SRC_FILE >/dev/null
|
|
|
|
$OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
|
2022-05-05 00:11:07 +08:00
|
|
|
done
|
|
|
|
exit 0
|