Nodes/Shibiko AI ComfyUI Tools/Shibiko AI - Remove Area By Mask
ComfyUI Node

Shibiko AI - Remove Area By Mask

Blank out whatever a mask points at

By Shibiko-AI·Created 2 years ago·Updated 8 months ago· 13
Shibiko AI - Remove Area By Mask
  • image
  • mask
  • image
invert_maskfalse

Given an image and a mask, this node zeroes out the masked area - the pixels go black, as if that region was cut away. It's the brute-force "remove" you reach for when you want a region gone before handing the image to something else: blank an unwanted object before an inpainting pass, knock out a background you've masked, or make sure a stray region doesn't influence a later step.

The name overpromises slightly. This isn't generative removal (nothing fills the hole back in) and it isn't transparency-based deletion - it's multiplication. The masked pixels are multiplied down to black, the rest of the image is untouched. If what you actually wanted was a clean black hole to inpaint into, great, this is it. If you wanted the region cut out with a hole in the canvas, this isn't that node.

How it works

It's a short chain: convert the image and mask tensors to OpenCV arrays, convert the mask to grayscale if it's RGB, resize the mask to match the image if sizes disagree, normalize to 0–1, optionally invert, then multiply:

masked = image * (1 - mask)

With invert_mask off, white in the mask means "remove" (the (1 - mask) flips it so white pixels multiply to zero). Flip invert_mask on and it's the opposite - you keep the masked region and blank everything else, which is a quick way to keep only a subject.

Inputs and outputs

  • image - required.
  • mask - required, a MASK.
  • invert_mask (default off) - flips which side gets removed.

Output is a single image. That output is ready to feed a VAE encode for masked inpainting, or straight to a Save Image if you just want the blanked result.

The quirk to know about

As written, the conversion helpers index image[0] and mask[0] - this node effectively works on a single image. Feed it a batch and you'll get back one processed frame, not a batch. Keep it on a single image and it's fine, but don't build a batch pipeline around it. One other honest note: because it produces hard black, the boundary between removed and kept pixels is sharp - no feathering here. If you need a soft edge, blur your mask before it arrives, or use the Cascade node's blurred mask output.

Install

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/Shibiko-AI/ShibikoAI-ComfyUI-Tools

Or ComfyUI Manager → "Shibiko" → install, restart. No models, no downloads. It's a small, sharp tool - use it for exactly what it says.

CategoryShibiko AI

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
maskMASK
invert_maskoptBOOLEANfalse

Outputs (1)

NameTypeDescription
imageIMAGE