ComfyUI Node
Contour Gap Closer
Detects broken contour lines and joins nearby endpoints to produce closed, continuous paths.
Contour Gap Closer
- image
- image
- contour_mask
◄max_gap20►
◄threshold0.50►
◄inverttrue►
◄morph_close_radius2►
◄re_skeletonizefalse►
◄direction_weight0.30►
◄iterations3►
◄output_mode▾►
◄dilation_radius1►
Categoryimage/contour
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| max_gap | INT | 201–200 | Maximum pixel distance between endpoints to bridge |
| threshold | FLOAT | 0.500.01–0.99 | Binarization threshold (0-1) |
| invert | BOOLEAN | true | True = dark lines on light background |
| morph_close_radius | INT | 20–20 | Morphological closing radius to heal micro-gaps first (0=skip) |
| re_skeletonize | BOOLEAN | false | Skeletonize the output to single-pixel lines |
| direction_weight | FLOAT | 0.300–1 | Direction matching strictness (0=any, 1=strict collinear) |
| iterations | INT | 31–10 | Repeat endpoint-detection + connection N times |
| output_mode | COMBO | 3 options: original_thickness, skeleton, dilated | |
| dilation_radius | INT | 11–10 | Line thickness when output_mode='dilated' |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| contour_mask | MASK | — |