"""Highest-magnification crops on the two glyph clusters that decide whether the case boundary is z_2 <= N or z_1 z_2 <= N. Raster only. """ import base64 import io from PIL import Image RUN = ".solveathome/twin-primes/runs/bf2-fd7c93e9fdc79517/work/" BLOCKS = [ ("p84 · Corollary header + case-1 hypothesis", "p84", (60, 1900, 1100, 2000), 4.0), ("p84 · Theorem supposition sentence (left half)", "p84", (60, 1000, 900, 1070), 4.0), ("p84 · Theorem main term (right half)", "p84", (500, 830, 1150, 910), 5.0), ] def uri(img): buf = io.BytesIO() img.save(buf, format="PNG") return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode() parts = [] for label, key, box, z in BLOCKS: page = Image.open(RUN + f"graham-{key}.png").convert("L") crop = page.crop(box) crop = crop.resize((int(crop.width * z), int(crop.height * z)), Image.LANCZOS) parts.append( f'
{label} · box {box} · x{z}
' ) with open(RUN + "graham-zooms3.html", "w", encoding="utf-8") as fh: fh.write( "Graham 1978 - glyph-critical zooms" "" + "".join(parts) ) print("wrote", RUN + "graham-zooms3.html")