Nodes/ComfyUI-MaxedOut/Skip If Mask Empty MXD
ComfyUI Node

Skip If Mask Empty MXD

Don't waste a KSampler pass on an empty mask

By Maxed-Out-99·Created about a year ago·Updated 29 days ago· 9
Skip If Mask Empty MXD
  • mask
  • mask

If you've built an inpaint or detailer workflow, you know the annoyance: a detector runs, finds nothing - no face, no object, no region - and your graph still burns a full KSampler pass regenerating the whole image because nothing bothered to check. Skip If Mask Empty MXD is the check. It sits between your mask producer and your sampler branch, and when the incoming mask has no detected region at all, it blocks the downstream nodes from running instead of wasting the compute.

How it works

It takes one mask input and, if any pixel in it is above zero - i.e. there's an actual detected region - it passes the mask through unchanged. If the mask is all zeros, it returns ComfyUI's ExecutionBlocker instead, which tells the execution engine to skip everything downstream of this node in that run. The downstream branch simply doesn't execute: no sampler pass, no wasted VRAM, no blank output that looks like a bug. The rest of your graph keeps running normally. It's the same execution-gating trick power packs like Impact have used for ages, wrapped up as a single purpose-built node.

The workflow it belongs to

The canonical shape: a detector (SAM, a face detector, a bbox node - anything producing a mask) feeds the sampler branch through this node. If the detector finds a subject, the mask flows through and the inpaint/detail branch runs. If it finds nothing, the branch is skipped entirely and the original image passes through untouched. For batch jobs - fifty images where some have no detectable face - that's the difference between a folder that processes in ten minutes and one that silently reprocesses half the frames needlessly.

Inputs

Just the one: mask. Output is the same mask, passed through unchanged when there's something in it (and an execution blocker when there isn't). The pass-through behavior is the nice part: when it does run, you're not losing the mask to the gate - downstream nodes get exactly the mask the detector produced.

Installing

ComfyUI Manager → search "Maxed Out" → install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Maxed-Out-99/ComfyUI-MaxedOut.git

No pip dependencies, no model downloads.

Common issues

The subtle one: gating with ExecutionBlocker means the whole downstream branch is skipped - so if your graph assumes the sampler branch always runs (say a node downstream unconditionally consumes its output), you can end up with missing inputs elsewhere. Keep the gate's scope tight: put it on the branch that should be optional, not on shared backbone nodes. Also, "empty" means all-zero: a mask with one stray bright pixel counts as non-empty and lets the branch run, so if your detector is noisy, clean the mask before it reaches this node.

CategoryMXD/Detector

Inputs (1)

NameTypeDefaultDescription
maskMASK

Outputs (1)

NameTypeDescription
maskMASK