Match Requests sheets to locked design frames

This commit is contained in:
justinzeus 2026-11-05 18:58:06 +01:00
parent 439eea3ff8
commit d9578ac405
17 changed files with 98 additions and 34 deletions

View file

@ -1,9 +1,11 @@
#!/usr/bin/env python3
"""Rasterize locked prototype rating marks at the Coming-in row's native pixel size."""
from pathlib import Path
from io import BytesIO
import hashlib
import json
import cairosvg
from PIL import Image, ImageOps
ROOT = Path(__file__).resolve().parent
SOURCE = ROOT / "request-marks"
@ -21,7 +23,9 @@ def main() -> None:
for source in sorted(SOURCE.glob("*.svg")):
target = OUTPUT / f"coming_in_rating_{source.stem}.png"
width = round(height * wordmark_ratio) if source.stem in ("imdb", "tmdb") else height
cairosvg.svg2png(url=str(source), write_to=str(target), output_width=width, output_height=height)
source_pixels = cairosvg.svg2png(url=str(source), output_height=height * 4)
with Image.open(BytesIO(source_pixels)) as image:
ImageOps.fit(image, (width, height), method=Image.Resampling.LANCZOS).save(target)
for path in (source, target):
manifest.append(f"{hashlib.sha256(path.read_bytes()).hexdigest()} {path.relative_to(ROOT)}")
(ROOT / "request-marks.sha256").write_text("\n".join(manifest) + "\n")