refactor: drop light wallpaper variant, show original beside each sample

This commit is contained in:
Richard Zink
2026-09-22 11:45:05 +02:00
parent b04bd317fd
commit e87d062503
21 changed files with 44 additions and 61 deletions
+18 -30
View File
@@ -1,15 +1,11 @@
#!/usr/bin/env bash
# ash-wallpaper.sh — turn a color photo into Ash-palette wallpapers:
# ash-wallpaper.sh — turn a color photo into an Ash-palette wallpaper:
# grayscale body tinted toward the Ash tones, with warm "ember" highlights
# (reds/oranges/golds) selectively preserved. Pleasantville-style.
#
# usage: tools/ash-wallpaper.sh INPUT [OUTBASE]
# usage: tools/ash-wallpaper.sh INPUT [OUTPUT]
#
# By default BOTH variants are rendered:
# OUTBASE-dark.png (void -> chalk ramp)
# OUTBASE-light.png (stone -> paper ramp)
# Set DARK=1 to render only dark, LIGHT=1 to render only light.
# OUTBASE defaults to INPUT-without-extension + "-ash".
# OUTPUT defaults to INPUT-without-extension + "-ash.png".
#
# tuning via environment (defaults shown):
# HUE_MAX=13% warm band: hue <= HUE_MAX
@@ -18,25 +14,22 @@
# SAT_MAX=45% at/above this saturation the highlight is full
# EMBER_BOOST=130 saturation multiplier (%) applied to highlight areas
# SENSITIVITY=8x45% sigmoidal contrast of the final mask
# BASE_LO= BASE_HI= override the grey ramp endpoints (applies to both
# rendered variants unless only one is generated)
# BASE_LO= BASE_HI= grey ramp endpoints (void -> chalk)
set -euo pipefail
IN=${1:?usage: ash-wallpaper.sh INPUT [OUTBASE]}
OUTBASE=${2:-${IN%.*}-ash}
IN=${1:?usage: ash-wallpaper.sh INPUT [OUTPUT]}
OUT=${2:-${IN%.*}-ash.png}
HUE_MAX=${HUE_MAX:-13%}
HUE_MIN=${HUE_MIN:-94%}
SAT_MIN=${SAT_MIN:-12%}
SAT_MAX=${SAT_MAX:-45%}
EMBER_BOOST=${EMBER_BOOST:-130}
SENSITIVITY=${SENSITIVITY:-8x45%}
BASE_LO=${BASE_LO:-#100f12}
BASE_HI=${BASE_HI:-#f3ede1}
if command -v magick >/dev/null; then IM=magick; else IM=convert; fi
if [[ ${DARK:-0} == 1 ]]; then VARIANTS=(dark)
elif [[ ${LIGHT:-0} == 1 ]]; then VARIANTS=(light)
else VARIANTS=(dark light); fi
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
@@ -50,18 +43,13 @@ trap 'rm -rf "$TMP"' EXIT
"$IM" "$TMP/band.png" "$TMP/satmask.png" -compose Multiply -composite \
-gaussian-blur 0x2 -sigmoidal-contrast "$SENSITIVITY" "$TMP/mask.png"
for preset in "${VARIANTS[@]}"; do
case "$preset" in
dark) lo=${BASE_LO:-#100f12}; hi=${BASE_HI:-#f3ede1} ;;
light) lo=${BASE_LO:-#b7ae98}; hi=${BASE_HI:-#f2ecdf} ;;
esac
# ash base + ember-touched highlights, joined by the mask
"$IM" "$IN" \
\( -clone 0 -modulate 100,0 +level-colors "$lo","$hi" \) \
\( -clone 0 -modulate "100,$EMBER_BOOST" \) \
-delete 0 \
\( +clone "$TMP/mask.png" -alpha off -compose CopyOpacity -composite \) \
-delete 1 -compose Over -composite \
-colorspace sRGB "$OUTBASE-$preset.png"
echo "wrote $OUTBASE-$preset.png"
done
# ash base + ember-touched highlights, joined by the mask
"$IM" "$IN" \
\( -clone 0 -modulate 100,0 +level-colors "$BASE_LO","$BASE_HI" \) \
\( -clone 0 -modulate "100,$EMBER_BOOST" \) \
-delete 0 \
\( +clone "$TMP/mask.png" -alpha off -compose CopyOpacity -composite \) \
-delete 1 -compose Over -composite \
-colorspace sRGB "$OUT"
echo "wrote $OUT"