From 59f166adec0b2a035b80711b9c88b2b8827be6f7 Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Thu, 5 Feb 2026 00:32:48 +1000 Subject: [PATCH] add favicon --- .gitignore | 1 + scripts/bakeimgs | 33 ++++++++++++++++++++++++++------- www/index.html | 10 ++++++++++ 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index c341ed4..3389e0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bake/ .sass-cache/ sandbox/ +www/imgs diff --git a/scripts/bakeimgs b/scripts/bakeimgs index b04afbb..aae2484 100755 --- a/scripts/bakeimgs +++ b/scripts/bakeimgs @@ -1,12 +1,31 @@ #!/usr/bin/env bash - -# TODO: write this as a Makefile maybe? +set -euo pipefail # ===== Configuration ===== # -IMGS_DIR="imgs" -BAKE_DIR="www/baked" +IMGS="imgs" +BAKED="www/imgs" +FAVICON="$BAKED/favicon" # ========================= # -mkdir -p "$BAKE_DIR" -magick -background '#000000' -size 100x100 "$IMGS_DIR/mirror-icon.svg" "$BAKE_DIR/mirror-icon.png" -magick "$IMGS_DIR/c00L_y2k_g1rL.png" -resize 50% "$BAKE_DIR/avatar.png" +mkdir -p "$BAKED" +mkdir -p "$FAVICON" + +echo 'Generating mirror icon' +magick -background '#000000' -size 100x100 "$IMGS/mirror-icon.svg" "$BAKED/mirror-icon.png" + +# resize avatar +echo "Resizing avatar" +magick "$IMGS/c00L_y2k_g1rL.png" -resize 50% "$BAKED/avatar.png" +# crop avatar +echo 'Cropping avatar' +magick "$IMGS/c00L_y2k_g1rL.png" -crop '%wx%w+0+180' "$BAKED/avatar_crop.png" + +# create favicon +echo 'Generating favicon.ico' +magick -define icon:auto-resize=16,32,48,64,128,256 -compress zip "$BAKED/avatar_crop.png" "$FAVICON/favicon.ico" +# create separate png favicon alternatives +for n in 16 32 48 64 128 256; do + echo "Generating favicon-${n}x${n}.png" + magick "$BAKED/avatar_crop.png" -resize "${n}x${n}" "$FAVICON/favicon-${n}x${n}.png" +done + diff --git a/www/index.html b/www/index.html index 9fcd45d..f3ca883 100644 --- a/www/index.html +++ b/www/index.html @@ -5,6 +5,16 @@ have you tried crying more? + + + + + + + + + +