Hisogram Equalize Mask Regions
Stretch a soft mask's contrast back out
- masks
- MASKS
(That typo - "Hisogram" - is the node's own display name in the pack, not an error on this page; the underlying class name, SaltMaskHistogramEqualizationRegion, is spelled correctly.) Matting-style masks - the fractional-alpha output of a model like BiRefNet's matting variants, or anything that predicts "70% foreground" instead of a hard yes/no - tend to bunch their values into a narrow middle band rather than spanning the full range. That makes a mask look washed-out and mushy instead of decisive. Histogram equalization is the standard fix: redistribute the pixel value histogram so it uses the full 0–255 range instead of clustering in the middle, which punches the contrast back up without hard-thresholding away the soft edges entirely.
How it works
It's the same operation you'd run on a low-contrast photograph, applied to the mask channel: compute the mask's value histogram, then remap pixel values so the cumulative distribution is spread more evenly across the available range. Pixels that were solidly foreground get pushed further toward fully "on," ambiguous mid-tones get spread apart from each other, and the whole mask ends up with more visual (and functional) separation between "this counts" and "this doesn't," while still keeping it as a gradient rather than a hard binary split.
The inputs and outputs that matter
masks(required, MASK) - the only input. No threshold or strength parameter here; equalization is a self-scaling operation that adapts to whatever distribution your specific mask already has, which is part of why it doesn't need a manual knob.
Output: MASKS, contrast-stretched.
How to install it
This node comes from get-salt-AI/SaltAI ("SaltAI-Open-Resources"), Salt AI's (getsalt.ai) open node pack. The company launched in March 2024 building hosted infrastructure to run ComfyUI workflows as Discord bots and, later, via API; this masking family and a set of animation-schedule nodes were the general-purpose utilities riding alongside the platform-specific ones, useful whether or not you ever touched Salt AI's own service.
Flagging this clearly because it changes how you'd actually get the node: github.com/get-salt-AI/SaltAI returns a 404 as of writing. It's gone from the org's repo listing and it isn't in ComfyUI Manager's index, so the usual "search Manager, install, restart" route and a fresh git clone both come up empty. If you already have this node installed from an earlier pull or a bundled environment, it keeps working fine - there's no model download involved and nothing that depends on Salt AI's servers being up.
Common issues & troubleshooting
A mask that was already high-contrast came back looking harsher than expected. Equalization amplifies whatever contrast structure already exists - run it on a mask that's basically already binary and it'll push the mid-tones that do exist to the extremes, which can look more aggressive than you wanted. It's built for soft, low-contrast masks, not clean ones.
You wanted this to threshold the mask and it didn't. Equalization redistributes values; it doesn't force pixels to 0 or 1. If you actually need a hard binary result, this isn't the tool - pair it with a threshold step afterward if you want both the contrast boost and a clean cutoff.
The result looks noisy in areas that used to be smooth gradients. Because equalization is sensitive to the exact shape of the histogram, a mask with subtle, smooth gradation (a soft matte edge, for instance) can come out looking blotchy once those small value differences get stretched apart. If that happens, try SaltMaskGaussianRegion after this one to smooth the result back out while keeping the improved contrast.
No dedicated documentation for this node exists beyond the repo's one-paragraph README. As with the rest of this filter family, the surest way to know exactly how it behaves on your mask is to run it and look - a Preview Image node before and after costs you nothing.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | — |