Preserve contained rating marks inside dark chips
Some checks failed
review/design-claude B1-B5,B7 fixed; B8 readiness item glyph/gap geometry deviates from locked st-086

This commit is contained in:
justinzeus 2026-11-05 19:10:25 +01:00
parent d9578ac405
commit b8d5d8a124
10 changed files with 11 additions and 15 deletions

View file

@ -1,11 +1,9 @@
#!/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"
@ -23,9 +21,7 @@ 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
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)
cairosvg.svg2png(url=str(source), write_to=str(target), output_width=width, output_height=height)
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")