ComfyUI Node

MaskImage

The whole node is one multiply — mask an image the cheap way

By un-seen·Created 2 years ago·Updated 2 years ago· 46
MaskImage
  • image
  • mask
  • IMAGE

MaskImage is the simplest node in this pack, and the most honest about it. You give it an image and a mask, and it multiplies them together: new_image = image * mask, with the mask given an extra channel dimension so it broadcasts across RGB. Everything outside the mask goes to black; everything inside stays. That's the entire node. No settings, no modes, no model, nothing to configure.

That sounds trivial until you remember how often you need exactly this. ComfyUI has masks everywhere - from SAM, from inpainting tools, from the pack's own GetLayerMask - but a MASK is a single-channel grayscale tensor and a lot of downstream nodes want an RGB image. MaskImage is the glue: take a mask from any of those sources, multiply it against your image, and you've got the content of that region as a plain IMAGE you can save, composite, or pass to a sampler.

The one thing to know: hard edges

Because it's a straight multiply with no feathering, blur, or alpha ramp, the mask boundary is exactly as soft as the mask itself. A crisp binary mask gives you a crisp, hard-edged cutout - fine for compositing or region isolation, wrong if you wanted a soft matte. If you need feathered edges, blur the mask first or reach for a node that does matting-style compositing. For a binary region extraction, this is the one you want, and it's basically free.

Inputs and outputs

  • image (IMAGE) - the image you're masking.
  • mask (MASK) - the selection. White keeps, black removes.
  • Output: IMAGE - the image multiplied by the mask, background zeroed out.

Wire the mask in from anything that emits MASK - GetLayerMask in this pack, SAM-style segmenters, hand-drawn mask nodes. The output IMAGE goes anywhere an image goes.

Installing it

Via ComfyUI Manager (search the pack title comfyui-tensorop) or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/un-seen/comfyui-tensorops
cd comfyui-tensorops
pip install -r requirements.txt

Restart ComfyUI after. Worth saying: this node needs nothing beyond what ComfyUI already ships - numpy and torch - but the pack's requirements file installs transformers, boto3, fal-client and friends regardless. If you only want this one node, that's a lot of baggage for a multiply. The repo's README is also empty, so don't expect documentation - the source is a 20-line file.

Where people get burned

  • Shape mismatch confusion. If the mask doesn't match the image's spatial dimensions, the multiply broadcasts in ways you didn't expect. Keep mask and image at the same resolution.
  • Manager conflict warnings. This pack names some nodes identically to Kijai's ComfyUI-Florence2, so installing it may trigger a clash warning even though this node has nothing to do with Florence-2.

You can absolutely build the same thing with core ComfyUI nodes - convert mask to image, multiply. MaskImage just saves you the two extra steps. For the price of admission, it's the least fussy node in the pack and the one you'll likely actually use.

Categorytensorops

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
maskMASK

Outputs (1)

NameTypeDescription
IMAGEIMAGE