AGSoft Draw Mask On Image
Paint your mask's shape onto the image, in any color
- image
- mask
- image
Masks are great for machines and terrible for eyeballs. A grayscale blob doesn't tell you what it covers, and when you're debugging an inpaint or a composite, you end up squinting at a white smear on black. AGSoft Draw Mask On Image solves the dumb, useful version of this: it fills the masked area of an image with a solid color you choose, so you can see exactly where a mask sits, overlaid on the actual picture. It's a visualization node, and it's one of those "why did nobody bother" utilities that earns a permanent spot in debugging graphs.
How it works
Feed it an image and a mask, pick a color_name, and the masked region (where the mask is bright) gets painted that color; the rest stays untouched. The color list is the standard 20: white, black, red, green, blue, yellow, cyan, magenta, the grays, orange, purple, pink, brown, lime, navy, teal, olive, maroon. It resolves the name via PIL's color table, so what you see is what you'd get from any CSS-style color name.
Two modifiers: invert_mask flips which region gets painted (handy when your mask is inverted in storage), and device defaults to CPU - this is cheap pixel work, so leave it there unless you're processing huge batches.
The masking itself is threshold-based: pixels where the mask is bright get the color, everything else keeps the original pixel. The result is a real IMAGE you can preview or feed onward. If you want to see a mask and its image in one glance, this is the node.
The one input you'll actually touch
color_name. Red or magenta are the practical picks - they pop against most photos, and magenta is the classic "selection overlay" color if you've used any photo editor ever. White works for dark images; black for bright ones. Everything else is set-and-forget.
Where it sits in a workflow
Typical use: your inpainting mask came from somewhere you don't fully trust (a detection node, a color picker, a hand-paint in a weird editor). Draw it onto the source image, glance at it, and confirm the mask covers what you think it covers - before you burn GPU time on an inpaint pass. It also works as a compositing aid: paint a region, feed the result to a node that keys on color, and you've turned a mask into a visual matte.
Installing it
Pack standard: ComfyUI Manager → search comfyui-AGSoft → install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
Pure PIL/torch, no models, no dependencies beyond ComfyUI's built-ins.
Common issues
Honestly, the only real gotchas are on the input side. If your painted region looks like it covers the wrong area, your mask was inverted - that's what invert_mask is for. If the paint looks patchy, your mask is semi-transparent gray rather than hard black/white; the node thresholds at ~127, so mid-gray regions get painted half-heartedly. And if the output looks identical to the input, check that the mask is actually connected - a disconnected mask input defaults to an empty mask, and an empty mask paints nothing.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| color_name | COMBO | white | 20 options: white, black, red, green, blue, yellow, +14 |
| invert_mask | BOOLEAN | false | — |
| device | COMBO | cpu | 2 options: cpu, cuda |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |