ADD build scripts

This commit is contained in:
Hoernschen 2025-04-17 16:21:16 +02:00
parent 57e72154a5
commit 1265491dee
Signed by: hoernschen
GPG key ID: 37591FAF4E6D3462
2 changed files with 40 additions and 0 deletions

31
assets/build/convImages.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
# Libary needed: ImageMagick
PARAMS=('-quality 60')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
shopt -s nullglob nocaseglob extglob
shopt -s globstar
# Resize
sizes=(320 640 960 1280)
for FILE in public/**/*.@(jpg|jpeg|tif|tiff|png|gif); do
DIR=$(dirname "$FILE")
NAME=$(basename "$FILE" | cut -d. -f1)
EXTENSION=$(basename "$FILE" | cut -d. -f2)
for size in ${sizes[@]}; do
convert "$FILE" -resize ${size}x${size}\> "${DIR}/${NAME}-${size}.${EXTENSION}"
done
done
# Web Optimized Formats
for FILE in public/**/*.@(jpg|jpeg|tif|tiff|png|gif); do
convert $PARAMS "$FILE" "${FILE}".webp;
convert $PARAMS "$FILE" "${FILE}".avif;
done

9
assets/build/genIco.sh Normal file
View file

@ -0,0 +1,9 @@
#!/bin/bash
# Libary needed: ImageMagick
#
# Needs 2 input args:
# 1. The path of the source file
# 2. The output path (with .ico extension)
convert -density 300 -define icon:auto-resize=96,64,48,32,16 -background none $1 $2