"""towebp.py [quality] — raw/.png in the evidence dir -> -screenshot-.webp in website/assets (Pillow, method 6). Refuses to overwrite an existing asset.""" import os, sys from PIL import Image app = sys.argv[1]; q = int(sys.argv[2]) if len(sys.argv) > 2 else 80 EV = os.environ["EV"]; A = "/mnt/5_hdd/felhom.eu/git/felhom.eu/website/assets" for n in (1, 2, 3): src = f"{EV}/{app}/raw/{n}.png"; dst = f"{A}/{app}-screenshot-{n}.webp" if os.path.exists(dst) and not os.environ.get("MINE"): sys.exit(f"refused: {dst} exists") im = Image.open(src).convert("RGB") im.save(dst, "WEBP", quality=q, method=6) print(dst, im.size, os.path.getsize(dst), "B")