Load Image Brush Mask
Paint a mask on the image itself — no mask editor needed
- image
- mask
- width
- height
ComfyUI's built-in mask editor is, let's be honest, an experience. Load Image Brush Mask (ycimagebrushmask) skips it entirely: the image is embedded on the node face, and you paint the mask directly on it. Brush to add, erase to remove, adjust the size, wire the mask out. No separate editor window, no save-and-reload dance.
It's part of ComfyUI-YCNodes_Toolkit, yichengup's pack of frontend-style nodes, and it's the natural companion to the pack's crop nodes: where Load Image Crop Expand hands you a crop and a mask marking the expansion area, this node hands you a hand-painted mask for the exact region you want regenerated.
How it works
Your image travels as base64 in the image_base64 widget (auto-filled when you upload). Your strokes serialize into brush_data in the format mode:size:opacity:x,y;x,y;..., with strokes separated by |. The backend parses that, then paints circles and interpolated line segments into a mask tensor - vectorized with numpy, so it stays quick even on large images. The erase mode zeroes the mask back out; everything else adds white (1.0).
brush_size- brush diameter, 1–200, default 80. This is the one you'll actually touch.brush_data/image_base64- both auto-managed by the UI; leave them alone.
Outputs: image, mask, width, height. The mask is 1.0 where you painted - exactly what an inpaint node wants.
The README's one big warning
Quote-worthy because it's the actual gotcha: before you export or share a workflow that uses this node, clear the image out (recreate the node). The embedded base64 image will balloon the exported workflow JSON into something enormous. The node's JavaScript does cache images to keep them out of saved workflows, but the author's own advice is the safe path - rebuild the node, let the image get re-uploaded on load.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes_Toolkit
Restart (or install via ComfyUI Manager, searching "ComfyUI-YCNodes_Toolkit"). Dependencies are just numpy and Pillow - no models. Feed the outputs into any inpainting node and you've got a local, zero-round-trip inpainting setup.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| brush_data | STRING | — | |
| brush_size | INT | 801–200 | — |
| image_base64 | STRING | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |