Image Minus Mask
Cut a subject out with the mask you already have
- image
- mask
- IMAGE
Most background-removal discussion is about the model that finds the subject - BiRefNet, rembg, that whole zoo. Image Minus Mask from the MoneyMaker pack (display name ComfyUI-Yuan) skips that step entirely. It assumes you already have a mask, and it does the boring part that every cutout workflow still needs: apply the mask and park the subject on a clean background. Transparent, black, or white - your pick.
That's the honest use case. You ran a segmentation model, or you painted a mask by hand, or your input PNG shipped with an alpha channel. Now you need the subject alone, on a flat background, to composite into another scene or save as a sticker. This node is that final step.
How it works
It takes three things: an image, a mask, and a background_type dropdown with exactly three choices - PNG, BLACK, WHITE. It thresholds the mask (anything above pure black becomes opaque), then:
- BLACK - keeps the subject, zeros everything else to black. The classic
bitwise_and. - WHITE - same idea, but the masked-out area is filled white instead.
- PNG - converts the result to RGBA, and here's the important bit: any pixel that is pure white (255, 255, 255) becomes fully transparent.
That last one is both the point and the trap. It's great when your subject is a photo on a white backdrop - the white background just vanishes, which is why the README markets it as "the segmented image." But it is white-pixel-based, not mask-based. A white shirt, a white highlight, a white text logo inside the masked region all go transparent too. If your subject contains pure white, use BLACK or WHITE instead and do the transparency step elsewhere.
The inputs that matter
Only three, and only one has real subtlety:
- image - your original, as an
IMAGEtensor. - mask - note the type: it's
IMAGE, not theMASKtype. ComfyUI is strict about this. If the node upstream of you outputs aMASK, you'll need a converter in between - the pack ships a "Mask To Gray" node that gets you partway (though it also outputsMASK), and core ComfyUI's "Convert Mask to Image" does the straight swap. If your mask node already outputs an image (many segmentation masks do), you're fine as-is. - background_type - the PNG/BLACK/WHITE enum above.
Output is a single IMAGE. The node is marked as an output node, so the result previews in the UI and it's meant to sit at the end of a branch - you can still wire the image onward, but think of it as the display step of a cutout chain.
Where people get burned
- Hard edges. The mask is thresholded, not feathered. Expect a crisp cut with zero alpha ramping. If you want soft edges, feather/blur the mask before it reaches this node (or use the pack's Mask Preprocess Morphology to grow or shrink it first).
- First frame only. Both inputs are sliced to
[0], so a batched input means only the first image and first mask get processed. Feed it one at a time. - The white-transparency behavior described above - read it again before you blame the node.
- The mask input is a plain
IMAGE; the node won't accept aMASK-typed wire directly. This is the #1 "why won't my connection attach" complaint with this pack, and it's worth knowing going in.
Install
It's part of the MoneyMaker pack, listed in ComfyUI Manager under ComfyUI-Yuan. Search "Yuan" or "MoneyMaker" in Manager, install, restart. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/Cyber-BlackCat/ComfyUI-MoneyMaker
Then restart ComfyUI. No model downloads - this is pure OpenCV/Pillow number-crunching. The real dependency it drags in is opencv-python (and scikit-image); those install automatically, and opencv-python is the one that can be slow on Windows. The repo's example_workflows/ folder has a ready-made workflow with demo images showing exactly the PNG/BLACK/WHITE difference, which is the fastest way to see if it behaves like you expect.
Fair warning: this is a small, hobbyist-maintained pack (category shows up as MoneyMaker😺), so treat it as a handy utility rather than infrastructure. For heavy production compositing you'd sooner reach for WAS Node Suite or Impact Pack. For "I have a mask, give me a clean cutout," it's exactly the right size.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | IMAGE | — | |
| background_type | COMBO | 3 options: PNG, BLACK, WHITE |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |