Files
hedena_gold/scripts/generate-brand-icons.py
T
s.esmaeili ea86636027 Initial commit: Hedena Gold monorepo.
First commit of the Hedena Gold product (separate from gold-bank): branding, package names, and deploy defaults aligned to the new brand; legacy Henza trees stay local-only via .gitignore.
2026-10-15 17:19:10 +03:30

35 lines
1.5 KiB
Python

from PIL import Image
from pathlib import Path
# Point `src` at your Hedena Gold master logo, then run from the repo root.
src = Path(r"path/to/hedena-gold-logo.webp")
img = Image.open(src).convert("RGBA")
print("source size", img.size)
root = Path(__file__).resolve().parents[1]
(root / "apps/user-app/public/img").mkdir(parents=True, exist_ok=True)
(root / "apps/user-app/src/assets/img").mkdir(parents=True, exist_ok=True)
(root / "apps/admin-panel/src/assets/images/logo").mkdir(parents=True, exist_ok=True)
img.save(root / "apps/user-app/public/img/brand-logo.webp", "WEBP")
img.save(root / "apps/user-app/public/img/brand-logo.png", "PNG")
img.save(root / "apps/user-app/src/assets/img/brand-logo.png", "PNG")
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-icon.webp", "WEBP")
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-icon.png", "PNG")
img.save(root / "apps/admin-panel/src/assets/images/logo/brand-horizontal.png", "PNG")
for size, path in [
(192, root / "apps/user-app/public/icon-192.png"),
(512, root / "apps/user-app/public/icon-512.png"),
(192, root / "apps/admin-panel/public/icon-192.png"),
(512, root / "apps/admin-panel/public/icon-512.png"),
]:
icon = Image.new("RGBA", (size, size), (0, 0, 0, 0))
fitted = img.copy()
fitted.thumbnail((size, size), Image.Resampling.LANCZOS)
x = (size - fitted.width) // 2
y = (size - fitted.height) // 2
icon.paste(fitted, (x, y), fitted)
icon.save(path, "PNG")
print("wrote", path)