Files
NotPika69andClaude Opus 5.5 d154ea13c2 Terminbuchung über PetWorkers und G&H-Zertifikat eingebaut
- "Termin buchen" in der Kopfleiste, im Kontakt und als Buchungs-Fläche mit allen Angeboten
- Direkte Buchen-Knöpfe für Einzelcoaching, Gruppenstunden und Stundenplan
- G&H-Siegel im Footer, auf Ernährung und bei den Ausbildungen
- Datenschutz um die Online-Terminbuchung ergänzt
- tools/make_zip.sh baut das Übergabe-Paket

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 11:01:49 +02:00

66 lines
2.5 KiB
Python

"""Erzeugt aus tools/originals/ die Web-Bilder in assets/img/ (WebP, zwei Größen) sowie Icons und Vorschaubild.
python3 tools/optimize_images.py
"""
import os
from PIL import Image, ImageDraw
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SRC = os.path.join(ROOT, "tools", "originals")
OUT = os.path.join(ROOT, "assets", "img")
os.makedirs(OUT, exist_ok=True)
CREAM = (252, 250, 244)
PHOTOS = ["katha-abendlicht", "katha-heide", "hund-wald", "hund-rennt", "futternapf", "laden", "kofferraum"]
def fit(img, longest):
img = img.copy()
img.thumbnail((longest, longest), Image.LANCZOS)
return img
def save_webp(img, name, quality=78):
path = os.path.join(OUT, name)
img.save(path, "WEBP", quality=quality, method=6)
print(f"{os.path.getsize(path) / 1024:6.0f} KB {name} {img.size[0]}x{img.size[1]}")
# Fotos: groß (1800) und klein (900) für Handy / halbe Kacheln
for name in PHOTOS:
img = Image.open(os.path.join(SRC, name + ".jpg")).convert("RGB")
save_webp(fit(img, 1800), f"{name}.webp")
save_webp(fit(img, 900), f"{name}-900.webp", quality=76)
# Logo und BARF-Teller mit Transparenz
logo = Image.open(os.path.join(SRC, "logo.png")).convert("RGBA")
save_webp(fit(logo, 640), "logo.webp", quality=90)
plate = Image.open(os.path.join(SRC, "barf-teller.png")).convert("RGBA")
save_webp(fit(plate, 900), "barf-teller.webp", quality=82)
# G&H-Zertifikatssiegel: transparenten Rand abschneiden
cert = Image.open(os.path.join(SRC, "gh-siegel.png")).convert("RGBA")
cert = cert.crop(cert.getchannel("A").getbbox())
save_webp(fit(cert, 480), "gh-siegel.webp", quality=90)
# Apple-Touch-Icon: Logo auf Creme
icon = Image.new("RGB", (180, 180), CREAM)
small = fit(logo, 172)
icon.paste(small, ((180 - small.width) // 2, (180 - small.height) // 2), small)
icon.save(os.path.join(ROOT, "apple-touch-icon.png"))
# Vorschaubild für WhatsApp / Facebook (1200x630): Foto + Logo-Siegel
og = Image.open(os.path.join(SRC, "katha-abendlicht.jpg")).convert("RGB")
scale = 1200 / og.width
og = og.resize((1200, round(og.height * scale)), Image.LANCZOS)
top = max(0, (og.height - 630) // 2)
og = og.crop((0, top, 1200, top + 630))
d = 300
seal = Image.new("RGBA", (d, d), (0, 0, 0, 0))
ImageDraw.Draw(seal).ellipse((0, 0, d - 1, d - 1), fill=CREAM + (255,))
lg = fit(logo, int(d * .94))
seal.paste(lg, ((d - lg.width) // 2, (d - lg.height) // 2), lg)
og.paste(seal, (1200 - d - 60, 50), seal) # oberhalb des Fotografen-Schriftzugs
og.save(os.path.join(OUT, "vorschau.jpg"), quality=82)
print("Icons und Vorschaubild erzeugt")