render-asset.sh: Use parallel for asset-dark as well
Also added cosmetic changes to the scripts.
Also added cosmetic changes to the scripts.
by roundabout, Sunday, 21 January 2018, 04:53:36 (1516510416), pushed by roundabout, Sunday, 11 May 2025, 13:22:19 (1746969739)
Author identity: nana-4 <hnmaigo@gmail.com>
62d928cc46169b575822cc40b6c1a0627d1c3064
#! /bin/bash
set -ueo pipefail
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
SRC_FILE="assets-dark.svg"
ASSETS_DIR="assets-dark"
i=${1}
GTK2_HIDPI=$(echo ${GTK2_HIDPI-False} | tr '[:upper:]' '[:lower:]')
if [[ ${GTK2_HIDPI} == "true" ]] ; then
EXTRA_OPTIONS="--export-dpi=192"
else
EXTRA_OPTIONS=""
fi
if [ -f $ASSETS_DIR/$i.png ]; then
echo $ASSETS_DIR/$i.png exists.
else
echo Rendering $ASSETS_DIR/$i.png
$INKSCAPE --export-id=$i \
--export-id-only \
--export-background-opacity=0 \
$EXTRA_OPTIONS \
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
fi
exit 0
$INKSCAPE --export-id=$i \
--export-id-only \
--export-background-opacity=0 \
$EXTRA_OPTIONS \
$EXTRA_OPTIONS \
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
fi
#! /bin/bash
set -ueo pipefail
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
SRC_FILE="assets-dark.svg"
ASSETS_DIR="assets-dark"
INDEX="assets.txt"
for i in `cat $INDEX`
do
if [ -f $ASSETS_DIR/$i.png ]; then
echo $ASSETS_DIR/$i.png exists.
else
echo
echo Rendering $ASSETS_DIR/$i.png
$INKSCAPE --export-id=$i \
--export-id-only \
--export-background-opacity=0 \
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
fi
done
_parallel() {
which parallel && parallel $@ || (
while read i; do
$1 $i
done
)
}
cat $INDEX | _parallel ./render-asset-dark.sh
exit 0
INDEX="assets.txt"
_parallel() {
which parallel && parallel $@ || (
while read i;
do
$1 $i
done
)
which parallel && parallel $@ || (
while read i; do
$1 $i
done
)
}
cat $INDEX | _parallel ./render-asset.sh
INDEX="assets.txt"
_parallel() {
which parallel && parallel $@ || (
while read i;
do
$1 $i
done
)
which parallel && parallel $@ || (
while read i; do
$1 $i
done
)
}
cat $INDEX | _parallel ./render-asset.sh