Files
aurora-curator/scripts/gen_icons.py
T

44 lines
1.6 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
"""Generates Aurora Curator's app icon set from the real logo mark.
Source master: scripts/logo/icon-source.png (the folder/aurora/filmstrip mark,
square-padded, transparent background - cropped from the full lockup that also
includes the "AURORA CURATOR" wordmark, which isn't used for the app icon itself).
Produces the sizes Tauri's bundler expects in src-tauri/icons/.
"""
from PIL import Image
import os
HERE = os.path.dirname(__file__)
SRC = os.path.join(HERE, "logo", "icon-source.png")
OUT = os.path.join(HERE, "..", "src-tauri", "icons")
os.makedirs(OUT, exist_ok=True)
master = Image.open(SRC).convert("RGBA")
if master.size != (1024, 1024):
master = master.resize((1024, 1024), Image.LANCZOS)
master.save(os.path.join(OUT, "icon-master.png"))
sizes = [32, 128, 256, 512, 1024]
for s in sizes:
master.resize((s, s), Image.LANCZOS).save(os.path.join(OUT, f"{s}x{s}.png"))
# Tauri's expected filenames
master.resize((32, 32), Image.LANCZOS).save(os.path.join(OUT, "32x32.png"))
master.resize((128, 128), Image.LANCZOS).save(os.path.join(OUT, "128x128.png"))
master.resize((256, 256), Image.LANCZOS).save(os.path.join(OUT, "[email protected]"))
# Windows .ico (multi-resolution)
ico_sizes = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
master.save(os.path.join(OUT, "icon.ico"), sizes=ico_sizes)
# macOS .icns
try:
master.save(os.path.join(OUT, "icon.icns"), format="ICNS")
except Exception as e:
print(f"WARN: could not write icon.icns via Pillow ({e}); leaving it out")
print("done:", sorted(os.listdir(OUT)))