Draw Bounding Boxes
Draw the Boxes So You Can See What the Detection Actually Found
- image
- bboxes
- IMAGE
Bounding boxes are invisible until you draw them. DrawBBox is the node that turns a list of BBOX objects into something you can actually look at - red rectangles over an image, with optional labels, exactly like an object-detection visualization.
You'll reach for it constantly while debugging. Feed it the output of a detection or segmentation chain and you instantly see whether boxes are on target, too tight, too loose, or pointing at the wrong thing entirely. It's the "show your work" step of the pack's bbox toolkit, and it saves more confusion than its trivial name suggests.
How it works
The node takes your image tensor and every BBOX in the list, then draws with Pillow on a separate transparent overlay layer before compositing it back onto the original. Drawing on its own layer is what lets it do Outline and Fill modes cleanly, and it guarantees labels always sit on top of the boxes rather than being half-buried. Boxes are clipped to the image bounds, so a box that overshoots the edge just gets trimmed instead of erroring.
Labels render in a bundled font (with a fallback to Pillow's default if the font file is missing - it prints a warning, doesn't crash), and the label plate is drawn solid and opaque above the rectangle. If a BBOX has an empty label and draw_label is on, there's simply nothing to draw.
Inputs that matter
- image - the
IMAGEto draw on. This input is list-mode, so a batch of images draws the same boxes across all of them. - bboxes - one or more
BBOXfrom the pack's own bbox nodes (MaskToBBox,ParseBBoxQwenVL, and friends). - draw_mode -
Outlinefor classic red borders, orFillfor a translucent red fill. Pick Outline for debugging, Fill when you want the region emphasized. - line_thickness (1–100, default 4) - outline weight.
- fill_opacity (0–1, default 0.4) - how see-through the fill is. Only matters in Fill mode.
- draw_label (default on) and font_size (8–200, default 25) - label toggle and size.
Output is an IMAGE list, same shape as the input, ready to wire into a preview or SaveImage.
Where it fits
Typical chain: mask → MaskToBBox → DrawBBox → preview. Or detection JSON → ParseBBoxQwenVL → DrawBBox when you're getting boxes back from a vision model. It's a pure visualization node - nothing about the drawing changes your data, so feel free to hang it off a parallel branch just to look.
Installing it
It's part of Duanyll Nodepack:
cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack
or install via ComfyUI Manager ("Duanyll Nodepack"). The pack's dependency list includes opencv-python-headless and Pillow is assumed present, so Manager installs cleanly.
Gotchas
Only a couple worth noting. First, this node speaks only the pack's own BBOX type - a core Comfy bbox or a plain tuple won't plug in. Second, the label font is a fixed set of bundled files; if you see the "font not found" warning, the drawing still works, just with a plainer typeface. And if boxes seem to be missing, check that your boxes' coordinates aren't entirely off-canvas - clipped-to-zero boxes get skipped silently.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| bboxes | BBOX | — | |
| draw_mode | COMBO | 2 options: Outline, Fill | |
| line_thickness | INT | 41–100 | — |
| fill_opacity | FLOAT | 0.400–1 | — |
| draw_label | BOOLEAN | true | — |
| font_size | INT | 258–200 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |