From 0eb768b78a186174516393c72064d02ba5210fbd Mon Sep 17 00:00:00 2001 From: Hoernschen Date: Thu, 11 Jan 2024 21:04:55 +0100 Subject: [PATCH] ADD image optimization script --- assets/build/images.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 assets/build/images.sh diff --git a/assets/build/images.sh b/assets/build/images.sh new file mode 100755 index 0000000..ba08c88 --- /dev/null +++ b/assets/build/images.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +PARAMS=('-quality 90') + +if [ $# -ne 0 ]; then + PARAMS=$@; +fi + +cd $(pwd) + +shopt -s nullglob nocaseglob extglob +shopt -s globstar + +# Resize + +# Web Optimized Formats +for FILE in static/**/*.@(jpg|jpeg|tif|tiff|png); do + magick $PARAMS "$FILE" "${FILE}".webp; + magick $PARAMS "$FILE" "${FILE}".avif; +done \ No newline at end of file