Remap Mask
Stretch a mask's contrast instead of just clamping it
- msks_list
- msks
Here's the difference between clamping and remapping: clamping stops values from escaping a range; remapping spreads them across a range. When your mask is stuck between 0.3 and 0.8 - flat, low-contrast, everything mid-gray - clamping to [0, 1] does nothing, because nothing is out of range. Remap Mask is the node that rescues that mask: it takes your source range and stretches it into a target range, so a weak mask becomes a full-contrast one.
This is a genuinely useful trick for regional conditioning. Masks that come out of blending, averaging, or rough hand-drawn sources tend to be low-contrast, and low-contrast masks give mushy, half-hearted conditioning. Remap them to use the full 0–1 range and the regions snap into focus.
How the optional inputs work
msks_list- the list of masks (list in, list out, same shapes).src_min,src_max- the source range. Here's the elegant part: these are optional andforceInput. If you leave them unwired, the node uses each mask's own minimum and maximum as the source range. So the default behavior is a per-mask auto-stretch to full contrast: darkest pixel → 0, brightest → 1. Wire them in only when you want a shared range across all masks (e.g. both 0 and 1) so every mask is remapped identically rather than individually.tgt_min,tgt_max- the destination range, defaulting to 0 and 1. This is your contrast dial. To keep a faint floor, settgt_minto 0.1; to cap strength, lowertgt_max. The result is clamped to the range spanned by the targets (and 0–1).
The math is a straight linear remap - (value - src_min) / (src_max - src_min) * (tgt_max - tgt_min) + tgt_min - with a guard against dividing by zero when the source range is flat (in that case it returns the target minimum, i.e. an empty mask, rather than NaN).
When to reach for it
- After aggregation or averaging -
averagein PseudoMaskAggregate flattens contrast; remap restores it. - Standardizing masks from different sources - if some masks are full-range and some are mid-range, remap each (unwired src) to put them all on the same footing.
- As a contrast control - setting
tgt_min/tgt_maxmanually is a soft way to control conditioning strength per mask without touching the Apply nodes' weights.
The trap
Because the default auto-stretches every mask to full range, it amplifies noise - a mask with a speckled edge gets its speckles stretched too. If your source masks are noisy, blur first (PseudoMaskBlur) and remap after. Also remember: it stretches but doesn't threshold; mid-gray stays mid-gray proportionally. If you want hard black/white, clamp or threshold afterwards.
Pack-standard install: clone Pseudocomfy into custom_nodes and restart, or grab it from Manager.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| msks_list | MASK | — | |
| src_minopt | FLOAT | — | |
| src_maxopt | FLOAT | — | |
| tgt_minopt | FLOAT | 0.000–1 | — |
| tgt_maxopt | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| msks | MASK | — |