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
70 changed files with 26 additions and 21 deletions

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