ComfyUI Node

Mask Exists

The mask version of Image Exists

By mickmumpitz·Created 8 months ago·Updated 10 days ago· 47
Mask Exists
  • mask
  • mask
  • exists

Mask Exists is the MASK-flavored twin of the pack's Image Exists: pass a mask through, and report whether there actually was one. If you've built conditional workflows where a mask input is sometimes wired and sometimes not - an optional inpainting region, an optional VFX area - you need to know at run time which case you're in, and a boolean is how you find out.

It's a deliberately small utility, and it pairs with the same family of lazy switches as its image sibling. Where ImageExists gives you a valid placeholder so downstream image nodes don't crash, this one gives you a exists flag so your routing logic can branch on mask presence.

How it works

If the mask input is connected, it's returned untouched along with exists = True. If not connected, the node returns an empty mask and exists = False. That's the whole mechanism - there's no placeholder trickery needed here, because a zero-valued MASK is a legitimate "no region selected" value that downstream nodes (blend, compose, inpaint) generally handle fine. The value of the node is purely the boolean: one small piece of state that lets a switch or conditional choose between "apply the mask" and "treat it as unmasked."

Where does it sit in a workflow? Typically right after mask-producing nodes like PoseKeypointToMask or an auto-segmentation output, where the mask might legitimately be absent for some frames or some shots - then route on exists before doing something expensive with the mask.

The inputs and outputs

  • mask (MASK, optional) - the mask to test and pass through.

Outputs:

  • mask (MASK) - your input if connected, or an empty (zeroed) mask if not.
  • exists (BOOLEAN) - true if a mask was connected, false otherwise.

Wire exists into a conditional switch; pass mask onward to whatever consumes it.

Installing it

Part of the Mickmumpitz pack - ComfyUI Manager, search "Mickmumpitz", install, restart:

cd ComfyUI/custom_nodes
git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git

No models, no extra deps.

Common issues

Same caveat as Image Exists, with an extra wrinkle: exists reports whether the input was connected, not whether the mask has any content. A connected-but-all-black mask still returns exists = True. If your decision is "does this frame have a detected region?" you want a semantic test - e.g. the has_frame / has_frames outputs on the pack's iteration nodes, or a mask-summation check - not this node. Use Mask Exists for wiring questions and it'll be right every time.

CategoryMickmumpitz/Utils

Inputs (1)

NameTypeDefaultDescription
maskoptMASK

Outputs (2)

NameTypeDescription
maskMASK
existsBOOLEAN