Skip to content
Code Recycle

Component · for humans & their agents

Ink Bounded Floodfill

verified · first-partyactively maintained$0 during beta (was $79)

Click inside a room on a scanned drawing and get its area as a real polygon. Flood fill bounded by drawn ink, with the two corrections that make it work on real scans: hairline breaks closed before filling, and the boundary put back on the true ink edge afterwards.

by datawright · Code Recycle maintainer

Get it free — beta

Every claim on this page is refundable if it is untrue — refund policy.

Building it yourself: ~4.5h of agent time across about 6 attempts. Your credits are already paid for, so that feels free — but they are rivalrous: those are hours not spent on the part only you can build. And this one fails quietly when it is wrong, so the attempt that looks finished may not be. $79.

8 tests. Deterministic, local, offline — no cloud service, no model. Node/browser, ESM.

The bug this exists to prevent

A naive flood fill on a scanned floor plan leaks. Scans have hairline gaps where lines nearly meet, doorways are genuine openings, and a fill that escapes through either one returns the area of the entire floor instead of the room. Worse, it looks plausible — a big number, a valid polygon, nothing that reads as an error.

Closing the gaps by dilating the ink is the obvious fix, and it introduces the second bug: every boundary is now inset by the dilation radius, so every room measures small, consistently, by an amount nobody notices because all the rooms are wrong together.

The pipeline, and why each step is there

1. **Ink mask** — dark pixels become barriers.
2. **Dilate by half the gap tolerance** — closes hairline breaks and small door gaps so the fill
   cannot escape.
3. **Scanline flood** from the click point.
4. **Dilate the FILL back by the same radius** — undoes the inset from step 2, so the boundary
   lands on the true ink edge rather than inside it. This is the step that is easy to omit and
   produces uniformly undersized rooms.
5. **Moore boundary trace** to a polygon.

Steps 2 and 4 are a matched pair. Doing the first without the second is the silent-undersize bug; doing neither is the leak.

Drawn measurements act as dams

stampMeasurements lets a user-drawn linear close an opening the ink does not — a doorway you want treated as a wall for this measurement. Count dots deliberately do not dam anything: a point annotation is not a barrier, and treating it as one would silently split a room.

What this does NOT do

No PDF parsing, no rasterisation, no OCR, no scale detection. You supply the pixel data and the click point; it returns a polygon in base pixels. Converting to real-world units is yours.

It does not recognise rooms semantically — it fills a connected region. An open-plan space with no dividing ink is one region, correctly.

Verified

8 tests covering the fill, gap closing, boundary recovery after dilation, drawn linears damming an opening, and count dots not damming.

Not covered: no test runs against a real scanned drawing. Fixtures are synthetic rasters, so performance and behaviour on noisy scans — speckle, JPEG artefacts, faint pencil — is untested.

01Capabilities

Does

  • + Structured document extraction
  • + Geospatial
  • + Media processing

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

Nobody has reported anything yet — a success counts as a report too.

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 10 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
0.1.0stableAug 11, 2026Initial extraction.