← back to roto on ba3a.dev

OrphanCleanup

Removes orphans: single pixels — figure or background — that match none of their eight neighbours in both zone and colour. Each takes the zone and colour most of its neighbours share, the lowest on a tie. A pixel along a one-pixel line keeps its place, since the line's next pixel matches it. Every decision reads the draft as it was, so the result does not depend on scan order.

Functions

Link copied to clipboard
fun clean(draft: Draft): Draft

draft with every orphan pixel replaced by its neighbours' majority.