PettyPaintMasksToImages
Turn a mask into a grayscale image you can see
- masks
- IMAGE
Masks are great for machines and miserable to eyeball. A MASK is a single-channel float tensor - black and white, no color - and half the time you want to see what you're working with, or you want to feed a mask into a node that insists on an IMAGE. PettyPaintMasksToImages is the converter that does it: MASK in, IMAGE out, with each mask expanded to a grayscale RGB image. It's the reverse of the pack's image-to-mask nodes, and it's one of those quiet utilities that makes a mask workflow actually legible.
It's part of the petty-paint pack, the ComfyUI-side integration for Petty Paint, Andrew Porter's web canvas that reimagines doodles through Stable Diffusion.
How it works
Each mask gets reshaped to a (1, 1, H, W) tensor, the singleton channel is moved to the end, and it's expanded across three channels - so the single grayscale channel becomes identical red, green, and blue. Result: a normal-looking RGB image that's just the mask rendered in shades of gray, white where the mask is white. Batch in, batch out.
Why you'd reach for it
Three concrete uses. Previewing - hook it into a preview node and you can actually check whether that mask is cutting your subject right before you spend a generation on it. Feeding mask-only nodes - some tools and custom nodes expect an IMAGE and will accept a mask's visual form happily. Saving masks to disk - you can't save a MASK with a plain Save Image node, but you can save the converted image, which is exactly how you'd export a selection for use in another program.
The inputs and outputs
masks- the MASK batch.- Output:
IMAGE(a batch of grayscale RGB images).
Pack quirk: the output is a Python list rather than a single tensor - add an index if a downstream node complains.
Installing it
Same pack, same install - ComfyUI Manager, search "petty-paint-comfyui-node":
cd ComfyUI/custom_nodes
git clone https://github.com/mephisto83/petty-paint-comfyui-node
Restart ComfyUI. Declared dependency is Flask==2.1.2; nothing heavy.
Common issues
The one thing to remember is that this is a visual conversion, not a "make the mask stronger" tool. If your mask is too soft or too small, converting it to an image won't fix that - it'll just show you the problem. And keep polarity in mind: an inverted mask converts to an inverted-looking image, which is usually correct behavior and usually exactly what you need to spot before it costs you a render.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |