HT Mask Validator
'is there anything actually in this mask?' — as a boolean
- mask
- has_mask_data
- normalized_mask
Masks lie. A mask that looks empty in the preview might have a few stray bright pixels; a mask from a shaky detector might be nearly blank; a "masked" inpainting pass can silently run on nothing and waste a generation. HT Mask Validator is the small sanity-check node that answers the question directly: it returns has_mask_data, a real BOOLEAN, telling you whether the mask actually contains content above a threshold - and it hands you back a normalized mask so you're working from a consistent format no matter what produced it.
What it does
Two inputs, two outputs, no surprises:
threshold(0 to 1, default 0) - the minimum pixel value that counts as "masked." Default 0 means "any non-zero pixel counts." Raise it if your masks are noisy - say a detector produces faint grey fuzz at 0.05 that you don't want to treat as real content.mask(optional) - if nothing is connected, the node has nothing to validate; hooking it up is the point.
The outputs:
has_mask_data(BOOLEAN) - true if the mask has pixels above threshold. This is the one that makes the node interesting, because a BOOLEAN can drive a conditional branch in your graph.normalized_mask(MASK) - the mask coerced to a single-channel, 0–1 range, BHWC format. Masks arriving from different sources (drawing tools, detectors, other packs) have different channel counts and value ranges; this flattens that variance.
The workflow it enables
The real use is conditional routing. has_mask_data feeds a switch/splitter: if the mask has content, run the inpainting or detail pass; if it's empty, skip it and pass the original through. That's how you build a batch pipeline that doesn't waste a sampling pass on inputs where nothing was detected - the exact pattern the KB's inpainting essay keeps circling: mask → edit → composite, and you only pay for the edit when there's something to edit.
The normalized_mask output is the quieter half of the value. Plumb it downstream instead of the raw mask and you've removed a whole class of "why is my mask 3 channels / 0-255 / weird-shaped" bugs before they bite.
Installing
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/ArtHommage/HommageTools.git
cd HommageTools && pip install -r requirements.txt
restart, or Manager → "HommageTools for ComfyUI". No models, no dependencies beyond the pack's own.
The honest take
This is a tiny node and it won't wow anyone, but "validate before you spend" is one of the genuinely useful habits in ComfyUI, and this is the cheapest way to build it into a graph. The main thing to remember: it validates that content exists, not where it is or whether it's good - a mask covering the wrong region still validates true. For that you'd want a detector or a visual check. And per the pack's alpha framing, the exact normalization rules could change between versions, so treat the normalized output as a convenience, not a spec.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| threshold | FLOAT | 0.000–1 | — |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| has_mask_data | BOOLEAN | — |
| normalized_mask | MASK | — |