๐ผ> Mask Curves
A tone-curve tool for cleaning up masks, not images
- mask
- mask
Think Photoshop's Curves tool, but pointed at a mask instead of an image. Masks that come out of a segmentation model, a threshold-based node, or an auto-generated source like this pack's own Light Source Mask are often close but not quite right - a little noisy near black, not quite solid enough near white. Mask Curves is for that cleanup pass.
How it works
It splits the mask's value range into four tonal zones - low, mid-low, mid, and high - and gives you an independent multiplier for each, plus one more multiplier for overall brightness on top. All five default to 1, which is neutral, so dropping this node into a graph changes nothing until you actually touch a slider - the same "off by default" pattern as this pack's Brightness and Contrast nodes.
The practical moves: push low_value_factor down to kill faint near-black noise and fringe pixels that a soft mask tends to accumulate. Push high_value_factor up to force near-white areas fully white, making a mushy mask read as more binary. Or work the two middle factors to reshape the falloff in between - useful if a mask's transition zone is too abrupt or too gradual for what you're compositing it into.
The inputs and outputs that matter
mask(MASK) - required, the mask you're reshaping.low_value_factor,mid_low_value_factor,mid_value_factor,high_value_factor(FLOAT each, 0โ3, step 0.05, default 1) - per-zone multipliers.brightness(FLOAT, 0โ3, step 0.05, default 1) - an overall multiplier applied on top of the zone adjustments.maskout - feed it wherever the original mask was headed.
How to install it
Via ComfyUI Manager: search "yanc" or "ComfyUI_yanc" and install, then restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc
then restart ComfyUI. No extra dependencies or model downloads.
Common issues & troubleshooting
Gradients turn blocky or posterized. Values above 1 amplify that zone, and cranking all four factors toward the 3 ceiling at once tends to push large flat areas to solid black or white abruptly, which shows up as visible banding on anything that used to be a smooth gradient. Moderate multipliers - roughly 1.2 to 1.8 - cover most real cleanup jobs; going straight to the max on everything usually looks worse than the mask you started with.
Nothing changed after adding the node. All five factors default to 1, a deliberate neutral. Move at least one slider.
You're not sure which zone controls what. There's no tooltip breaking down exactly where each zone's boundary sits, so the fastest way to learn the mapping is empirically: push one factor at a time to an extreme (say, low_value_factor to 3) and watch which part of the mask moves.
The mask you fed in wasn't actually a MASK type. This node expects a real mask input, not an image - if you're trying to reshape something that came out as an IMAGE (a grayscale render, say), convert it to a mask first with a standard ComfyUI conversion node.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | โ | |
| low_value_factor | FLOAT | 1.000โ3 | โ |
| mid_low_value_factor | FLOAT | 1.000โ3 | โ |
| mid_value_factor | FLOAT | 1.000โ3 | โ |
| high_value_factor | FLOAT | 1.000โ3 | โ |
| brightness | FLOAT | 1.000โ3 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | โ |