feat: Compression script with compressed images
Also modified genicons.sh Signed-off-by: txtsd <code@ihavea.quest>
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 171 KiB After Width: | Height: | Size: 170 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 608 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 525 B |
Before Width: | Height: | Size: 912 B After Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 176 B |
Before Width: | Height: | Size: 828 B After Width: | Height: | Size: 826 B |
Before Width: | Height: | Size: 912 B After Width: | Height: | Size: 857 B |
Before Width: | Height: | Size: 1022 B After Width: | Height: | Size: 1009 B |
Before Width: | Height: | Size: 916 B After Width: | Height: | Size: 739 B |
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 907 B After Width: | Height: | Size: 905 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 475 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 832 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 589 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 987 B After Width: | Height: | Size: 969 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 791 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 890 B After Width: | Height: | Size: 887 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 920 B After Width: | Height: | Size: 917 B |
Before Width: | Height: | Size: 958 B After Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 10 KiB |
@ -9,16 +9,7 @@ svg2png() {
|
|||||||
inkscape -w "$width" -h "$height" -o "$output_file" "$input_file"
|
inkscape -w "$width" -h "$height" -o "$output_file" "$input_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
sipsresize() {
|
if command -v "inkscape" && command -v "icotool" && command -v "oxipng"; then
|
||||||
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
|
|
||||||
# Windows ICO
|
# Windows ICO
|
||||||
d=$(mktemp -d)
|
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_128.png" 128 128
|
||||||
svg2png org.prismlauncher.PrismLauncher.svg "$d/prismlauncher_256.png" 256 256
|
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 \
|
rm prismlauncher.ico && icotool -o prismlauncher.ico -c \
|
||||||
"$d/prismlauncher_256.png" \
|
"$d/prismlauncher_256.png" \
|
||||||
"$d/prismlauncher_128.png" \
|
"$d/prismlauncher_128.png" \
|
||||||
@ -40,10 +33,10 @@ if command -v "inkscape" && command -v "icotool"; then
|
|||||||
"$d/prismlauncher_16.png"
|
"$d/prismlauncher_16.png"
|
||||||
else
|
else
|
||||||
echo "ERROR: Windows icons were NOT generated!" >&2
|
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
|
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
|
# macOS ICNS
|
||||||
d=$(mktemp -d)
|
d=$(mktemp -d)
|
||||||
|
|
||||||
@ -51,19 +44,22 @@ if command -v "inkscape" && command -v "sips" && command -v "iconutil"; then
|
|||||||
|
|
||||||
mkdir -p "$d"
|
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
|
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
|
oxipng --opt max --strip all --alpha --interlace 0 "$d/icon_"*".png"
|
||||||
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
|
|
||||||
iconutil -c icns "$d"
|
iconutil -c icns "$d"
|
||||||
else
|
else
|
||||||
echo "ERROR: macOS icons were NOT generated!" >&2
|
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
|
fi
|
||||||
|
|
||||||
# replace icon in themes
|
# replace icon in themes
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 364 KiB |
9
scripts/compress_images.sh
Executable 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 {} \;
|