From 10ffbd8c68adcf446dbd7511c6a3ea60bb007581 Mon Sep 17 00:00:00 2001 From: Kantine Wrapper Date: Thu, 26 Feb 2026 12:43:03 +0100 Subject: [PATCH] build: automatically generate favicon.png from favicon_base.png if present --- build-bookmarklet.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build-bookmarklet.sh b/build-bookmarklet.sh index 847b8ed..34af5b7 100755 --- a/build-bookmarklet.sh +++ b/build-bookmarklet.sh @@ -24,6 +24,24 @@ echo "=== Kantine Bookmarklet Builder ($VERSION) ===" # Check files exist if [ ! -f "$CSS_FILE" ]; then echo "ERROR: $CSS_FILE not found"; exit 1; fi if [ ! -f "$JS_FILE" ]; then echo "ERROR: $JS_FILE not found"; exit 1; fi + +# Generate favicon.png from favicon_base.png if base exists +FAVICON_BASE="$SCRIPT_DIR/favicon_base.png" +if [ -f "$FAVICON_BASE" ]; then + echo "Generating 32x32 favicon.png from favicon_base.png..." + python3 -c " +import sys +from PIL import Image +try: + img = Image.open('$FAVICON_BASE') + img_resized = img.resize((32, 32), Image.Resampling.LANCZOS) + img_resized.save('$FAVICON_FILE') +except Exception as e: + print('Favicon generation error:', e) + sys.exit(1) +" +fi + if [ ! -f "$FAVICON_FILE" ]; then echo "ERROR: $FAVICON_FILE not found"; exit 1; fi # Generate favicon Base64 data URI from PNG