feat: Compression script with compressed images

Also modified genicons.sh

Signed-off-by: txtsd <code@ihavea.quest>
This commit is contained in:
txtsd 2024-11-13 19:04:31 +05:30
parent 885fc66c14
commit 03b34e39f8
No known key found for this signature in database
GPG Key ID: 6AF185AB2001A97E
70 changed files with 26 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 912 B

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 826 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 912 B

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 B

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 987 B

After

Width:  |  Height:  |  Size: 969 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 B

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

After

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 958 B

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -9,16 +9,7 @@ svg2png() {
inkscape -w "$width" -h "$height" -o "$output_file" "$input_file"
}
sipsresize() {
input_file="$1"
output_file="$2"
width="$3"
height="$4"
sips -z "$width" "$height" "$input_file" --out "$output_file"
}
if command -v "inkscape" && command -v "icotool"; then
if command -v "inkscape" && command -v "icotool" && command -v "oxipng"; then
# Windows ICO
d=$(mktemp -d)
@ -30,6 +21,8 @@ if command -v "inkscape" && command -v "icotool"; then
svg2png org.prismlauncher.PrismLauncher.svg "$d/prismlauncher_128.png" 128 128
svg2png org.prismlauncher.PrismLauncher.svg "$d/prismlauncher_256.png" 256 256
oxipng --opt max --strip all --alpha --interlace 0 "$d/prismlauncher_"*".png"
rm prismlauncher.ico && icotool -o prismlauncher.ico -c \
"$d/prismlauncher_256.png" \
"$d/prismlauncher_128.png" \
@ -40,10 +33,10 @@ if command -v "inkscape" && command -v "icotool"; then
"$d/prismlauncher_16.png"
else
echo "ERROR: Windows icons were NOT generated!" >&2
echo "ERROR: requires inkscape and icotool in PATH"
echo "ERROR: requires inkscape, icotool and oxipng in PATH"
fi
if command -v "inkscape" && command -v "sips" && command -v "iconutil"; then
if command -v "inkscape" && command -v "iconutil" && command -v "oxipng"; then
# macOS ICNS
d=$(mktemp -d)
@ -51,19 +44,22 @@ if command -v "inkscape" && command -v "sips" && command -v "iconutil"; then
mkdir -p "$d"
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_16x16.png" 16 16
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_16x16@2.png" 32 32
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_32x32.png" 32 32
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_32x32@2.png" 64 64
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_128x128.png" 128 128
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_128x128@2.png" 256 256
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_256x256.png" 256 256
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_256x256@2.png" 512 512
svg2png org.prismlauncher.PrismLauncher.bigsur.svg "$d/icon_512x512@2x.png" 1024 1024
sipsresize "$d/icon_512x512@2.png" "$d/icon_16x16.png" 16 16
sipsresize "$d/icon_512x512@2.png" "$d/icon_16x16@2.png" 32 32
sipsresize "$d/icon_512x512@2.png" "$d/icon_32x32.png" 32 32
sipsresize "$d/icon_512x512@2.png" "$d/icon_32x32@2.png" 64 64
sipsresize "$d/icon_512x512@2.png" "$d/icon_128x128.png" 128 128
sipsresize "$d/icon_512x512@2.png" "$d/icon_128x128@2.png" 256 256
sipsresize "$d/icon_512x512@2.png" "$d/icon_256x256.png" 256 256
sipsresize "$d/icon_512x512@2.png" "$d/icon_256x256@2.png" 512 512
oxipng --opt max --strip all --alpha --interlace 0 "$d/icon_"*".png"
iconutil -c icns "$d"
else
echo "ERROR: macOS icons were NOT generated!" >&2
echo "ERROR: requires inkscape, sips and iconutil in PATH"
echo "ERROR: requires inkscape, iconutil and oxipng in PATH"
fi
# replace icon in themes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 364 KiB

9
scripts/compress_images.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
## If current working dirctory is ./scripts, ask to invoke from one directory up
if [ ! -d "scripts" ]; then
echo "Please run this script from the root directory of the project"
exit 1
fi
find . -type f -name '*.png' -not -path '*/libraries/*' -exec oxipng --opt max --strip all --alpha --interlace 0 {} \;