#!/usr/bin/env python3 """P43 evidence: NEAREST 2x close-up sheet of the two new HUD cards. Crops the top-right calendar/clock card and the bottom 10-slot hotbar from the `LV_P43_SHOT=1` day frame and stacks them at exactly 2x with NEAREST so pixel edges stay sharp. The sheet is a pure function of the input PNG (fixed crop boxes, fixed gap), no synthetic pixels. Usage: python3 scripts/make-p43-hud-closeup.py """ import sys from pathlib import Path from PIL import Image SOURCE = "p43-hud-day.png" OUT_NAME = "p43-hud-closeup-2x.png" # (left, top, right, bottom) in the 1280x720 frame; rects from the p43-shot log. CALENDAR_BOX = (1124, 44, 1272, 102) HOTBAR_BOX = (398, 655, 882, 719) GAP = 12 def main(argv): if len(argv) != 3: sys.stderr.write(__doc__) return 2 record_dir = Path(argv[1]) out_dir = Path(argv[2]) out_dir.mkdir(parents=True, exist_ok=True) source = Image.open(record_dir / SOURCE).convert("RGBA") crops = [source.crop(CALENDAR_BOX), source.crop(HOTBAR_BOX)] doubled = [c.resize((c.width * 2, c.height * 2), Image.NEAREST) for c in crops] width = max(img.width for img in doubled) height = sum(img.height for img in doubled) + GAP * (len(doubled) - 1) sheet = Image.new("RGBA", (width, height), (0, 0, 0, 0)) y = 0 for img in doubled: sheet.paste(img, (0, y)) y += img.height + GAP sheet.save(out_dir / OUT_NAME) print(f"ok {OUT_NAME} {sheet.width}x{sheet.height} from {SOURCE} boxes={[CALENDAR_BOX, HOTBAR_BOX]}") return 0 if __name__ == "__main__": raise SystemExit(main(sys.argv))