Merge pull request #89 from Dragon8oy/compress-images

Combined 12 different rendering scripts into 1
This commit is contained in:
Vince 2020-10-17 19:39:04 +08:00 committed by GitHub
commit e83c89b0a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 83 additions and 512 deletions

View file

@ -1,35 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-1080p"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,36 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-2k"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-dpi=144 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,36 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-4k"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-dpi=192 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,26 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-1080p"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

@ -1,27 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-2k"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-dpi=144 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

@ -1,27 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-4k"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-dpi=192 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="36"
height="36"
viewBox="0 0 9.5249997 9.5250002"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
sodipodi:docname="select.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#b7b7b7"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="7.919596"
inkscape:cx="16.187532"
inkscape:cy="24.609314"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:window-width="1366"
inkscape:window-height="714"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid28" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-287.47498)">
<rect
style="opacity:0.15;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.52916658;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="select_c"
width="2.1166654"
height="9.5249996"
x="3.96875"
y="287.47498"
ry="0.016929913" />
<path
style="opacity:0.15;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.52916658;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="m 3.9527305,287.47604 c -0.7253518,0.009 -1.3068969,0.59441 -1.3068969,1.32188 v 6.87917 c 0,0.72747 0.5815451,1.31324 1.3068969,1.32188 0.00858,-8.4e-4 0.01602,-0.007 0.01602,-0.016 v -9.49089 c 0,-0.009 -0.00744,-0.0152 -0.01602,-0.016 z"
id="select_w"
inkscape:connector-curvature="0" />
<path
style="opacity:0.15;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.52916658;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
d="m 6.1014366,287.47604 c -0.00858,8.4e-4 -0.01602,0.007 -0.01602,0.016 v 9.49089 c 0,0.009 0.00744,0.0152 0.01602,0.016 0.7253517,-0.009 1.3068967,-0.59441 1.3068967,-1.32188 v -6.87917 c 0,-0.72747 -0.581545,-1.31324 -1.3068967,-1.32188 z"
id="select_e"
inkscape:connector-curvature="0" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -1,3 +0,0 @@
select_w
select_c
select_e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 372 B

View file

@ -1,55 +0,0 @@
android
anonymous
antergos
arcolinux
elementary
korora
mageia
steamos
archlinux
fedora
freebsd
kubuntu
manjaro
ubuntu
chakra
gentoo
opensuse
windows
debian
parrot
gnu-linux
linuxmint
siduction
xubuntu
deepin
kali
lubuntu
solus
kaos
void
macosx
haiku
endeavouros
pop-os
mx-linux
devuan
4MLinux
AlpineLinux
SystemRescueCD
recovery
restart
shutdown
cancel
driver
edit
efi
find.efi
find.none
help
kbd
lang
type
tz
unset

View file

@ -1,35 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-1080p"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,36 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-2k"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-dpi=144 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,36 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="logos.txt"
ASSETS_DIR="icons-4k"
SRC_FILE="logos.svg"
install -d $ASSETS_DIR
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-dpi=192 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
cd $ASSETS_DIR
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
exit 0

View file

@ -1,26 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-1080p"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

@ -1,27 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-2k"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-dpi=144 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

@ -1,27 +0,0 @@
#! /bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
INDEX="select.txt"
ASSETS_DIR="select-4k"
SRC_FILE="select.svg"
install -d $ASSETS_DIR
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-dpi=192 \
--export-id-only \
--export-filename=$ASSETS_DIR/$i.png $SRC_FILE >/dev/null
$OPTIPNG -o7 --quiet $ASSETS_DIR/$1.png
fi
done
exit 0

View file

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View file

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

14
assets/render-all.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
COLORS=("color" "white")
TYPES=("icons" "select")
RESOLUTIONS=("1080p" "2k" "4k")
for COLOR in "${COLORS[@]}"; do
for TYPE in "${TYPES[@]}"; do
for RESOLUTION in "${RESOLUTIONS[@]}"; do
echo "./render-assets.sh \"$COLOR\" \"$TYPE\" \"$RESOLUTION\": "
./render-assets.sh "$COLOR" "$TYPE" "$RESOLUTION"
done
done
done

69
assets/render-assets.sh Executable file
View file

@ -0,0 +1,69 @@
#!/bin/bash
INKSCAPE="/usr/bin/inkscape"
OPTIPNG="/usr/bin/optipng"
if [[ "$1" == "color" ]]; then
cd "assets-color" || exit 1
elif [[ "$1" == "white" ]]; then
cd "assets-white" || exit 1
else
echo "Please use either 'color' or 'white'"
exit 1
fi
if [[ "$2" == "icons" ]]; then
EXPORT_TYPE="icons"
INDEX="../logos.txt"
SRC_FILE="../logos-$1.svg"
elif [[ "$2" == "select" ]]; then
EXPORT_TYPE="select"
INDEX="../select.txt"
SRC_FILE="../select.svg"
else
echo "Please use either 'icons' or 'select'"
exit 1
fi
if [[ "$3" == "1080p" ]]; then
ASSETS_DIR="$EXPORT_TYPE-1080p"
EXPORT_DPI="96"
elif [[ "$3" == "2k" ]] || [[ "$3" == "2K" ]]; then
ASSETS_DIR="$EXPORT_TYPE-2k"
EXPORT_DPI="144"
elif [[ "$3" == "4k" ]] || [[ "$3" == "4K" ]]; then
ASSETS_DIR="$EXPORT_TYPE-4k"
EXPORT_DPI="192"
else
echo "Please use either '1080p', '2k' or '4k'"
exit 1
fi
install -d "$ASSETS_DIR"
while read -r i; do
if [[ -f "$ASSETS_DIR/$i.png" ]]; then
echo "$ASSETS_DIR/$i.png exists"
elif [[ "$i" == "" ]]; then
continue
else
echo -e "\nRendering $ASSETS_DIR/$i.png"
$INKSCAPE "--export-id=$i" \
"--export-dpi=$EXPORT_DPI" \
"--export-id-only" \
"--export-filename=$ASSETS_DIR/$i.png" "$SRC_FILE" >/dev/null
$OPTIPNG -o7 --quiet "$ASSETS_DIR/$1.png"
fi
done < "$INDEX"
if [[ "$EXPORT_TYPE" == "icons" ]]; then
cd $ASSETS_DIR || exit 1
cp -a archlinux.png arch.png
cp -a gnu-linux.png linux.png
cp -a gnu-linux.png unknown.png
cp -a gnu-linux.png lfs.png
cp -a manjaro.png Manjaro.i686.png
cp -a manjaro.png Manjaro.x86_64.png
cp -a driver.png memtest.png
fi
exit 0

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB