main
John Lauer Public-facing docs: final-board images, Fields numbers from the final solve, clips merged into one page 5b68870
#!/usr/bin/env python3
"""Render SVGs side by side on #0d1117 with headless Chrome. usage: render.py out.png a.svg b.svg ..."""
import os, subprocess, sys, tempfile, html
CH = os.environ.get("CHROME", "chrome")
out, files = sys.argv[1], sys.argv[2:]
cells = "".join(f'<div><img src="file://{os.path.abspath(f)}"><p>{html.escape(os.path.basename(f))}</p></div>' for f in files)
page = f"""<html><body style="margin:0;background:#0d1117;color:#ccc;font:12px monospace;display:flex;flex-wrap:wrap">
<style>div{{width:400px;padding:4px}} img{{width:400px;height:400px;background:#0d1117}}</style>{cells}</body></html>"""
t = tempfile.NamedTemporaryFile("w", suffix=".html", delete=False); t.write(page); t.close()
cols = min(len(files), 4); rows = (len(files) + 3) // 4
subprocess.run(["nice", CH, "--headless", "--no-sandbox", "--disable-gpu", "--allow-file-access-from-files",
                f"--screenshot={os.path.abspath(out)}", f"--window-size={cols*408},{rows*430}", "file://" + t.name],
               check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(out)