• 6–11 Text noise: punctuation recovery; valuable text + area ≥16; short ASCII confidence gate; watermark suffix rescale; scanlator and ornament pruning.
• Direction graph: gap 2, char gap 0.6, alignment 1.5, font ratio 1.5, aspect tolerance 1; connected-component majority assigns horizontal/vertical.
• Merge graph: aspect tolerance 1.3, font ratio 2, char gaps 1/3; rotated candidates require angle ≤15° and relative font delta ≤0.25.
• For 3+ lines, build complete weighted graph → Kruskal MST → keep if max edge ≤ mean + 2σ or ≤1.5× font; else cut largest edge and recurse.
• Assemble blocks top-to-bottom or right-to-left; CJK joins without spaces; minimum line font wins; angle <3° snaps to zero; fit minimum-area rectangle.
Typesetting — Two Binary Searches + Affine Render
• Font fitter: 5% inset, line height 1.2, search 6 px…max; Pass 1 clean binary fit; Pass 2 tall-box geometric cap when H/W ≥2.0.
• Pass 3 scans down with six-stage hyphenation for words ≥7 chars when H/W ≥1.5; Pass 4 runs fallback binary search to the 6 px floor.
• Balanced wrap: greedy line count N → binary-search the minimum width preserving ≤N lines → centered diamond/inverted-pyramid stanza.
• Median dialogue cap max(18, round(median×1.25)) → decollide boxes → sample central 20–80% for color → exact lines → aspect pad → affine warp.
Parallel Compute + Output Contract
• Translation: Google GTX chunks ≤1800 chars with ⟦index⟧ delimiters; LLM batches 15 tagged segments and writes results back by tag index.
• Inpaint: raw surviving line polygons only; Simple uses luminance ≥180 RGB median, Telea-like FMM radius 3, neural tiers (LaMa/AOT-GAN) use 64px dynamic patch bucketing with UNCLIP 1.8 stroke expansion.
• Promise.all waits for translated text and clean plate; raw DBNet mask forwarding remains rejected to avoid erasing non-text bubble art.
• Persist clean image plus editable fitted lines in Dexie; return a separate baked PNG data URL for immediate DOM replacement.