#!/usr/bin/env python3
"""Render captured real-server transcripts as readable images; no UI is simulated."""
import pathlib, subprocess, sys, textwrap
for name in sys.argv[1:]:
    source = pathlib.Path(name)
    lines = []
    for line in source.read_text().splitlines():
        lines.extend(textwrap.wrap(line, width=100, subsequent_indent='   ', replace_whitespace=False) or [''])
    text = '\n'.join(lines)
    subprocess.run(['convert', '-size', f'1500x{max(1000, 70+len(lines)*28)}', 'xc:#111827', '-font', 'DejaVu-Sans-Mono', '-pointsize', '22', '-fill', '#f3f4f6', '-interline-spacing', '2', '-annotate', '+32+45', text, str(source.with_suffix('.png'))], check=True)
