Files
werk/scripts/render-tool-icons.py

16 lines
718 B
Python

#!/usr/bin/env python3
"""Export the tools' shared clay artwork as Linux launcher PNGs."""
from pathlib import Path
from PIL import Image, ImageOps
root = Path(__file__).resolve().parents[1]
output = root / "packaging/linux/icons"
output.mkdir(exist_ok=True)
for app in ("pass", "auth", "calculator", "clock", "calendar", "gallery", "workbook", "taskmgr"):
sources = list((root / "assets/tools").glob(f"{app}.*"))
if len(sources) != 1:
raise SystemExit(f"Expected one artwork source for {app}, found {len(sources)}")
with Image.open(sources[0]) as image:
icon = ImageOps.pad(image.convert("RGBA"), (512, 512), method=Image.Resampling.LANCZOS)
icon.save(output / f"werk-{app}.png")