Nodes/SaltAI-Open-Resources/Clip Harden Region
ComfyUI Node

Clip Harden Region

Push a soft mask toward solid without fully binarizing it

By get-salt-AI·Created 2 years ago·Updated 2 years ago· 84
Clip Harden Region
  • masks
  • MASKS
strength1.50

The middle ground between doing nothing and SaltMaskCeilingRegion's all-or-nothing hard clamp. Clip Harden Region pushes a soft mask's values toward the extremes - closer to solid black or solid white - without fully flattening it the way ceiling does. Think of it as a contrast curve applied specifically to your mask's gradient.

How it works

strength controls how hard that push is. Low values barely change anything; high values start to approach the same hard-binarize effect ceiling gives you for free, but on a continuous dial instead of an on/off switch. That matters when you want a mask that's mostly solid in the middle but still feathers gently right at the very edge, rather than cutting hard everywhere.

Where this earns a spot over the other filters in the same category: SaltMaskCeilingRegion has no dial at all, and SaltMaskAdaptiveThresholdingRegion makes a hard local decision per pixel. This one is the node to reach for when the honest answer is "somewhere in between" - a mask that's confident in the middle of the region and genuinely uncertain at the edges, where you'd rather keep a little of that uncertainty than erase it.

The inputs and outputs that matter

  • masks (required, MASK).
  • strength (optional, default 1.5, 0.1–6) - the only real knob. Default is a mild push; go toward 6 for something close to a hard threshold, toward 0.1 for something that barely touches the mask.

Output is MASKS, contrast-hardened.

How to install it

ComfyUI Manager: search SaltAI-Open-Resources or SaltAI, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/get-salt-AI/SaltAI

then restart. No dependency to speak of.

Common issues & troubleshooting

Trying to get a fully binary mask by cranking strength. Don't fight it there - even at strength near 6 you're approaching a hard result asymptotically, not guaranteeing one. If you actually want a genuinely binary mask, use SaltMaskCeilingRegion (all non-zero becomes full white) or SaltMaskAdaptiveThresholdingRegion (an actual threshold decision) instead, which are built to guarantee that outcome directly rather than making you tune toward it.

Barely any visible effect at default strength. 1.5 is intentionally mild. If your mask is already fairly soft and you want it noticeably firmer, push toward 3–4 before concluding the node isn't doing anything.

Edges look harsher than expected on an already-crisp mask. If your input mask was close to binary already, even a moderate strength will push what little gradient remained toward the extremes, which can read as a slightly jagged edge on a mask that didn't need hardening in the first place. Skip this node on masks that are already clean.

Not sure whether to reach for this or SaltMaskCeilingRegion. If you can tolerate a mask that's still slightly soft at the very edge, use this one and tune strength up until it looks right. If you need a guaranteed hard binary result and don't care about losing the edge gradation entirely, skip straight to ceiling - it's simpler and there's no strength value to second-guess.

CategorySALT/Masking/Filter

Inputs (2)

NameTypeDefaultDescription
masksMASK
strengthoptFLOAT1.500.1–6

Outputs (1)

NameTypeDescription
MASKSMASK