render assets in parallel
parent
b12b2e758a
commit
4c5755ccb2
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="$(which inkscape)"
|
||||
OPTIPNG="$(which optipng)"
|
||||
|
||||
ASSETS_DIR="$1"
|
||||
SRC_FILE="${ASSETS_DIR}".svg
|
||||
|
||||
i="$2"
|
||||
|
||||
result_file="$ASSETS_DIR/$i.png"
|
||||
if [[ -f "${result_file}" ]] ; then
|
||||
echo "${result_file} already exists."
|
||||
else
|
||||
echo "Rendering '${result_file}'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-png="${result_file}" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "${result_file}"
|
||||
fi
|
||||
|
||||
if [[ "$OPTION_GTK2_HIDPI" == "true" ]]; then
|
||||
result_file_hidpi="$ASSETS_DIR/$i@2.png"
|
||||
if [[ -f "${result_file_hidpi}" ]] ; then
|
||||
echo "${result_file_hidpi} already exists."
|
||||
else
|
||||
echo "Rendering '${result_file_hidpi}'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-dpi=192 \
|
||||
--export-png="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "${result_file_hidpi}"
|
||||
fi
|
||||
fi
|
|
@ -1,41 +1,22 @@
|
|||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
# Make sure that parallel is GNU parallel and not moreutils.
|
||||
# Otherwise, it fails silently. There's no smooth way to detect this.
|
||||
if [[ "$(which parallel 2> /dev/null)" ]]; then
|
||||
cmd=(parallel)
|
||||
else
|
||||
cmd=(xargs -n1)
|
||||
fi
|
||||
|
||||
INKSCAPE="/usr/bin/inkscape"
|
||||
OPTIPNG="/usr/bin/optipng"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
ASSETS_DIR="assets"
|
||||
|
||||
DARK_SRC_FILE="assets-dark.svg"
|
||||
DARK_ASSETS_DIR="assets-dark"
|
||||
|
||||
INDEX="assets.txt"
|
||||
|
||||
for i in `cat $INDEX`
|
||||
do
|
||||
"${cmd[@]}" ./render-asset.sh ${ASSETS_DIR} < assets.txt
|
||||
"${cmd[@]}" ./render-asset.sh ${DARK_ASSETS_DIR} < assets.txt
|
||||
|
||||
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-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
|
||||
fi
|
||||
|
||||
if [ -f $DARK_ASSETS_DIR/$i.png ]; then
|
||||
echo $DARK_ASSETS_DIR/$i.png exists.
|
||||
else
|
||||
echo
|
||||
echo Rendering $DARK_ASSETS_DIR/$i.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-id-only \
|
||||
--export-png=$DARK_ASSETS_DIR/$i.png $DARK_SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $DARK_ASSETS_DIR/$i.png
|
||||
fi
|
||||
done
|
||||
|
||||
cp $ASSETS_DIR/entry-toolbar.png menubar-toolbar/entry-toolbar.png
|
||||
cp $ASSETS_DIR/entry-active-toolbar.png menubar-toolbar/entry-active-toolbar.png
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="$(which inkscape)"
|
||||
OPTIPNG="$(which optipng)"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
ASSETS_DIR="assets"
|
||||
|
||||
i="$1"
|
||||
|
||||
echo "Rendering '$ASSETS_DIR/$i.png'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-png="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
|
||||
|
||||
echo "Rendering '$ASSETS_DIR/$i@2.png'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-dpi=192 \
|
||||
--export-png="$ASSETS_DIR/$i@2.png" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
|
|
@ -1,34 +1,12 @@
|
|||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="/usr/bin/inkscape"
|
||||
OPTIPNG="/usr/bin/optipng"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
ASSETS_DIR="assets"
|
||||
INDEX="assets.txt"
|
||||
|
||||
for i in `cat $INDEX`
|
||||
do
|
||||
if [ -f $ASSETS_DIR/$i.png ]; then
|
||||
echo $ASSETS_DIR/$i.png exists.
|
||||
# Make sure that parallel is GNU parallel and not moreutils.
|
||||
# Otherwise, it fails silently. There's no smooth way to detect this.
|
||||
if [[ "$(which parallel 2> /dev/null)" ]]; then
|
||||
cmd=(parallel)
|
||||
else
|
||||
echo
|
||||
echo Rendering $ASSETS_DIR/$i.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-id-only \
|
||||
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
|
||||
cmd=(xargs -n1)
|
||||
fi
|
||||
if [ -f $ASSETS_DIR/$i@2.png ]; then
|
||||
echo $ASSETS_DIR/$i@2.png exists.
|
||||
else
|
||||
echo
|
||||
echo Rendering $ASSETS_DIR/$i@2.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-dpi=180 \
|
||||
--export-id-only \
|
||||
--export-png=$ASSETS_DIR/$i@2.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i@2.png
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
|
||||
"${cmd[@]}" ./render-asset.sh < assets.txt
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="$(which inkscape)"
|
||||
OPTIPNG="$(which optipng)"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
ASSETS_DIR="assets"
|
||||
|
||||
i="$1"
|
||||
|
||||
echo "Rendering '$ASSETS_DIR/$i.png'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-png="$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i.png"
|
||||
|
||||
echo "Rendering '$ASSETS_DIR/$i@2.png'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-dpi=192 \
|
||||
--export-png="$ASSETS_DIR/$i@2.png" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "$ASSETS_DIR/$i@2.png"
|
|
@ -1,34 +1,12 @@
|
|||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="/usr/bin/inkscape"
|
||||
OPTIPNG="/usr/bin/optipng"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
ASSETS_DIR="assets"
|
||||
INDEX="assets.txt"
|
||||
|
||||
for i in `cat $INDEX`
|
||||
do
|
||||
if [ -f $ASSETS_DIR/$i.png ]; then
|
||||
echo $ASSETS_DIR/$i.png exists.
|
||||
# Make sure that parallel is GNU parallel and not moreutils.
|
||||
# Otherwise, it fails silently. There's no smooth way to detect this.
|
||||
if [[ "$(which parallel 2> /dev/null)" ]]; then
|
||||
cmd=(parallel)
|
||||
else
|
||||
echo
|
||||
echo Rendering $ASSETS_DIR/$i.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-id-only \
|
||||
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
|
||||
cmd=(xargs -n1)
|
||||
fi
|
||||
if [ -f $ASSETS_DIR/$i@2.png ]; then
|
||||
echo $ASSETS_DIR/$i@2.png exists.
|
||||
else
|
||||
echo
|
||||
echo Rendering $ASSETS_DIR/$i@2.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-dpi=180 \
|
||||
--export-id-only \
|
||||
--export-png=$ASSETS_DIR/$i@2.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i@2.png
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
|
||||
"${cmd[@]}" ./render-asset.sh < assets.txt
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="$(which inkscape)"
|
||||
OPTIPNG="$(which optipng)"
|
||||
|
||||
ASSETS_DIR="$1"
|
||||
SRC_FILE="${ASSETS_DIR}".svg
|
||||
|
||||
i="$2"
|
||||
|
||||
result_file="$ASSETS_DIR/$i.png"
|
||||
if [[ -f "${result_file}" ]] ; then
|
||||
echo "${result_file} already exists."
|
||||
else
|
||||
echo "Rendering '${result_file}'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-png="${result_file}" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "${result_file}"
|
||||
fi
|
||||
|
||||
if [[ "$OPTION_GTK2_HIDPI" == "true" ]]; then
|
||||
result_file_hidpi="$ASSETS_DIR/$i@2.png"
|
||||
if [[ -f "${result_file_hidpi}" ]] ; then
|
||||
echo "${result_file_hidpi} already exists."
|
||||
else
|
||||
echo "Rendering '${result_file_hidpi}'"
|
||||
"$INKSCAPE" --export-id="$i" \
|
||||
--export-id-only \
|
||||
--export-dpi=192 \
|
||||
--export-png="${result_file_hidpi}" "$SRC_FILE" >/dev/null \
|
||||
&& "$OPTIPNG" -o7 --quiet "${result_file_hidpi}"
|
||||
fi
|
||||
fi
|
|
@ -1,36 +1,13 @@
|
|||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
set -ueo pipefail
|
||||
|
||||
INKSCAPE="/usr/bin/inkscape"
|
||||
OPTIPNG="/usr/bin/optipng"
|
||||
|
||||
SRC_FILE="assets.svg"
|
||||
DARK_SRC_FILE="assets-dark.svg"
|
||||
ASSETS_DIR="assets"
|
||||
DARK_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.
|
||||
# Make sure that parallel is GNU parallel and not moreutils.
|
||||
# Otherwise, it fails silently. There's no smooth way to detect this.
|
||||
if [[ "$(which parallel 2> /dev/null)" ]]; then
|
||||
cmd=(parallel)
|
||||
else
|
||||
echo
|
||||
echo Rendering $ASSETS_DIR/$i.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-id-only \
|
||||
--export-png=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $ASSETS_DIR/$i.png
|
||||
cmd=(xargs -n1)
|
||||
fi
|
||||
if [ -f $DARK_ASSETS_DIR/$i.png ]; then
|
||||
echo $DARK_ASSETS_DIR/$i.png exists.
|
||||
else
|
||||
echo
|
||||
echo Rendering $DARK_ASSETS_DIR/$i.png
|
||||
$INKSCAPE --export-id=$i \
|
||||
--export-id-only \
|
||||
--export-png=$DARK_ASSETS_DIR/$i.png $DARK_SRC_FILE >/dev/null \
|
||||
&& $OPTIPNG -o7 --quiet $DARK_ASSETS_DIR/$i.png
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
|
||||
"${cmd[@]}" ./render-asset.sh assets < assets.txt
|
||||
"${cmd[@]}" ./render-asset.sh assets-dark < assets.txt
|
||||
|
|
Loading…
Reference in New Issue