Draw Gray BBox
Gray Out a Detected Subject in One Node
- images
- bboxes
- images
- mask
Wan VACE inpainting wants two things from you: a video where the thing-to-replace has been painted over with mid-gray, and a matching mask saying where the gray is. Do that by hand - mask, blur, composite - and you're redoing it for every frame. Draw Gray BBox is the shortcut: it takes a set of detected bounding boxes, fills those regions with neutral gray (0.5), and hands you both the grayed image and the matching binary mask. You connect, you don't paint.
It's aimed squarely at the VACE workflow, but the shape is more general: "I know roughly where the subject is, and I want it erased to gray with a clean mask." If you're doing object removal, background replacement, or any region-based inpaint, this is the plumbing that gets you from "detected" to "ready for the model."
How it works
The bboxes input takes the BOUNDING_BOX type - the exact structure produced by comfy-core's RT-DETR Detect and Draw BBoxes nodes. That's the clever bit: you don't hand-type coordinates. Detect subjects with RT-DETR, pass its bounding boxes straight in, and every detected region gets:
- Painted solid gray (value 0.5, mid-gray - the same filler VACE expects), and
- Marked white (1.0) in the matching
maskoutput, everything else black.
The one real knob is expand (pixels, default 0): it grows each box outward on all sides before filling. A little expansion - 8–16px - swallows the detection slop around a subject and avoids leaving a gray halo or a masked-out sliver of background. There's no feathering here, and that's on purpose: the mask is meant to be clean and binary for VACE, not soft.
Outputs are images (the grayed batch) and mask (binary, VACE-ready). Wire images into your VACE-inpaint conditioning and mask into the mask socket - or keep both for a separate pass. Note the masks and images keep the same batch structure as the input, so per-frame detection just works.
A fair warning about accuracy: this fills whole boxes, so it over-covers - it erases everything inside the box, not just the subject. For a clean VACE inpaint region that's usually fine (VACE will re-render the box's contents). If you need the subject erased but not the background behind it, this isn't the node; that's what a SAM-based segmentation-to-gray pipeline is for.
Install
Search "Trent Nodes" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt
No models here - the gray fill and mask are plain tensor ops. You do need a BOUNDING_BOX producer upstream, but that's comfy-core's own RT-DETR nodes, not this pack. Restart ComfyUI after installing. (Manager can be flaky on this pack per the author's note about an early repo rename; manual clone is the fallback.)
Common issues
- Nothing turns gray. The
bboxesinput won't take a plain list of numbers - it must come from a BOUNDING_BOX node like RT-DETR Detect. Check that your upstream node actually outputs that type. - Gray halo around the subject. Reduce
expand, or accept it: VACE will repaint the whole box region anyway. - The mask has soft edges you didn't ask for. It shouldn't - this node's mask is binary by design. If you're seeing softness, something downstream is feathering it.
For "detect it, gray it, inpaint it" in three nodes, this is the fastest route in the pack. Pair it with a detection node upstream and a VACE sampler downstream, and the tedious part of region inpainting disappears.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| bboxes | BOUNDING_BOX | — | |
| expand | INT | 00–1024 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| mask | MASK | — |