"""Create a review sheet from native Three.js captures; validate local structure crops.""" import json from pathlib import Path from PIL import Image, ImageChops, ImageDraw, ImageFont root = Path(__file__).resolve().parents[1] out = root / '.verify/landing-horizontal-20261109' metadata = json.loads((out / 'horizontal-smooth.json').read_text()) raw = Image.open(out / 'horizontal.png').convert('RGBA') smooth = Image.open(out / 'horizontal-smooth.png').convert('RGBA') checks = [] for point in metadata['points']: x, y = point['x'] * 2, point['y'] * 2 box = (int(x - 48), int(y - 8), int(x + 48), int(y + 120)) assert ImageChops.difference(raw.crop(box), smooth.crop(box)).getbbox() is None, point['name'] checks.append(point['name'] + ' local structure pixels unchanged') assert metadata['along'] == 0 assert metadata['outline']['addedOutsideSourcePixels'] == 0 checks.extend(['horizontal camera has zero along-axis component', 'no pixels added outside source']) sheet = Image.new('RGB', (1600, 1050), '#f5f8fb') draw = ImageDraw.Draw(sheet) font = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 23) small = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', 17) previous = out / 'before-horizontal/okseong-model-hero.png' panels = [ ('PREVIOUS / diagonal view, rough survey boundary', previous if previous.exists() else root / '랜딩페이지/assets/okseong-model-hero.png'), ('PROPOSAL / horizontal orthographic view, inward curved boundary', out / 'horizontal-smooth.png'), ] for i, (label, path) in enumerate(panels): y = 25 + i * 510 draw.rounded_rectangle((20, y, 1580, y + 480), radius=20, fill='white', outline='#dce4ed') draw.text((45, y + 20), label, font=font, fill='#19334d') image = Image.open(path).convert('RGBA') image = image.crop(image.getbbox()) image.thumbnail((1500, 380), Image.Resampling.LANCZOS) sheet.paste(image, ((1600 - image.width) // 2, y + 80 + (380 - image.height) // 2), image) if i == 1: draw.text((45, y + 445), '6 piers + 2 abutments preserved / original survey unchanged / preview only', font=small, fill='#52667a') sheet.save(out / 'comparison.png') (out / 'review-report.json').write_text(json.dumps({'result': 'PASS', 'checks': checks}, indent=2)) print(f'PASS {len(checks)} review checks; {out / "comparison.png"}')