Mask Image (Davcha)
Cut everything outside the mask, alpha included
- image
- mask
- IMAGE
A mask tells a model where to change; this node tells it where to not look at all. Mask Image (Davcha) multiplies an image by a mask so that masked-out regions go fully black - and, crucially, it also zeroes the alpha channel, so what's outside the mask becomes genuinely transparent. That's the difference between "darkened" and "gone."
It's part of comfyui_davcha, the "personal QoL and experimental nodes" pack, and it's a direct utility that does exactly one thing with no settings to misconfigure.
How it works
The mask gets resized to the image dimensions with bicubic interpolation, then multiplied across every channel. If the image has no alpha channel it appends one filled with ones first - so after the multiplication that new alpha channel is literally the mask. Output is an RGBA image where the masked region is untouched, everything else is black and fully transparent.
Inputs: image (IMAGE) and mask (MASK). Output: IMAGE (RGBA).
Note how this differs from the same pack's ApplyMask node, which zeroes only the RGB channels and leaves alpha at 1 - that keeps masked areas black but opaque. Here the masked-out area is transparent too, which is what you want when the next step is compositing, not inpainting.
When you'd reach for it
- Cutting out a subject - mask a person, get a transparent cutout to paste onto another background.
- Compositing prep - feed the transparent result into a blend or a ControlNet that cares about alpha.
- Forcing a model to ignore a region - a fully transparent, zeroed region is a stronger signal than grayed-out pixels in some img2img chains.
Installing it
# ComfyUI Manager → Install Custom Nodes → search "comfyui_davcha" → Install → Restart
# or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/dchatel/comfyui_davcha
cd comfyui_davcha
pip install -r requirements.txt
Standard pack catch: nodes.py imports llama_cpp and cv2 at module load while requirements.txt only lists webp and rapidfuzz. If the pack won't load, pip install llama-cpp-python opencv-python and restart.
One honest warning: multiplying by a mask is lossless on the masked region but throws away the rest - there's no feathering and no undo. If your mask has a hard edge you'll get a hard cut; run the mask through SoftErosion (same pack) first for a feathered matte. And a mask that's entirely black will produce an image with nothing in it, which is a silent failure - SmartMask in the same pack guards against exactly that.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |