Canvas BBox Mask
Bboxes turned into real mask tensors
- mask_1
- mask_2
- mask_3
- mask_4
- mask_5
- mask_6
- mask_7
- mask_8
- mask_9
- mask_10
- mask_batch
- width
- height
Canvas BBox Mask is the sibling of Canvas BBox in the same pack - same drawing canvas, but instead of giving you coordinate strings, it gives you actual MASK tensors. You drag rectangles on the node face and each one comes out as a white rectangle on a black mask, at your canvas resolution. If your downstream pipeline eats masks rather than bbox strings, this is the node you want, and it saves you a string-to-mask conversion step entirely.
The author's canvas-drawing code traces back to Smirnov75's ComfyUI-mxToolkit, and like its sibling it's a widget-first node: set the canvas size, draw, run.
How it works
You set canvas_width and canvas_height (64–4096). The rectangles serialize into mask_data as x,y,w,h;x,y,w,h;.... On run, the backend creates one all-black mask per slot and paints each region white (1.0), clamping coordinates to the canvas so off-canvas rectangles don't crash anything.
Outputs:
mask_1throughmask_10- one mask per drawn rectangle, in order.mask_batch- all drawn regions stacked into a single(N, H, W)batch, which is what you'll feed batch-oriented mask consumers.width,height- canvas size echoed.
The honest caveats
Unused slots come out as all-black masks, not empty. That's fine most of the time, but a stack of black masks in a batch will quietly do nothing - filter or slice before you feed a 10-slot output somewhere that assumes every entry matters. And this node gives you rectangular regions only; if you need soft or hand-painted masks, use the pack's Load Image Brush Mask instead. These two cover different jobs.
Installing
Same pack, same ritual:
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes_Toolkit
Restart, and it shows up under YCNodes Toolkit. Dependencies are numpy and Pillow - no models, no weight downloads. It's a small node, and it's best treated that way: a fast way to lay down several region masks for regional conditioning or targeted inpainting without opening any editor.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| canvas_width | INT | 51264–4096 | — |
| canvas_height | INT | 51264–4096 | — |
| mask_data | STRING | — |
Outputs (13)
| Name | Type | Description |
|---|---|---|
| mask_1 | MASK | — |
| mask_2 | MASK | — |
| mask_3 | MASK | — |
| mask_4 | MASK | — |
| mask_5 | MASK | — |
| mask_6 | MASK | — |
| mask_7 | MASK | — |
| mask_8 | MASK | — |
| mask_9 | MASK | — |
| mask_10 | MASK | — |
| mask_batch | MASK | — |
| width | INT | — |
| height | INT | — |