ComfyUI Node
CV Draw Contours
Debug helper: draws contours on the image (cv2.drawContours). Two contour sets over one image should differ in 'line_style' as well as color, so the distinction does not depend on hue. Drawing nothing (0 contours) is fine - the image passes through unchanged. The output comes back in the same format as the image input (IMAGE in, IMAGE out; MASK in, MASK out).
CV Draw Contours
- source
- contours
- image
◄color(0, 255, 0)►
◄thickness2►
◄fillfalse►
◄max_draw0►
◄line_stylesolid►
Categoryimage/CV/contours
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| source | COMFY_MATCHTYPE_V3 | Image or mask to draw on (a copy is made; the input is not modified). Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size. | |
| contours | CV_CONTOURS | Contours to draw, e.g. from 'CV Find Contours'. | |
| color | STRING | (0, 255, 0) | Color as a single value (broadcast to all channels) or BGR tuple, e.g. '255' or '(0, 255, 0)'. Shorter tuples are zero-padded; longer tuples are truncated - so on a single-channel MASK canvas a BGR tuple keeps only its BLUE component ('(0, 255, 0)' becomes 0, i.e. draws nothing visible). Use a single value like '255' for a MASK. |
| thickness | INT | 21–64 | Outline width in pixels (ignored when 'fill' is on). |
| fill | BOOLEAN | false | Fill the contours instead of outlining them. |
| max_draw | INT | 00–10000 | Draw at most this many contours (largest first, as sorted by 'CV Find Contours'). 0 = all. |
| line_styleopt | COMBO | solid | Stroke pattern. Colour alone cannot separate two overlaid line sets for a colour-blind viewer or in greyscale - give the second set a different style and the picture reads without the palette. 'solid' is cv2's own line. Ignored when 'fill' is on. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Same format as the image input. |