Nodes/Pseudocomfy/Remap Float
ComfyUI Node

Remap Float

Turn a 0–1 value into any range you actually need

By Pseudotools·Created 2 years ago·Updated 19 days ago· 4
Remap Float
    • val
    val
    tgt_min0.00
    tgt_max1.00

    Normalized floats are a curse in ComfyUI's gift-wrapping. Half the nodes in the ecosystem speak in 0–1 (weights, strengths, percents), and half speak in real-world numbers (CFG from 1 to 20, denoise from 0 to 1 but you need 0.4–0.9, temperature, scale). The conversion is a line of arithmetic you end up rebuilding everywhere. Remap Float is that line of arithmetic as a node: it takes a value assumed to be in [0, 1] and remaps it into the tgt_mintgt_max range you declare.

    The mechanics

    • val - the input FLOAT, forceInput, so it must come over a wire (typically from a mask node's output, a math node, or a widget you're repurposing).
    • tgt_min, tgt_max (both default 0.0 and 1.0) - the destination range. The defaults make it a no-op until you change them, which is honest design: nothing surprising happens if you wire it up wrong.
    • Output val - the remapped FLOAT.

    The formula is the standard one: (val / 1) * (tgt_max - tgt_min) + tgt_min, with three safety behaviors worth knowing:

    • It clamps the input to [0, 1] first. A val of 1.3 remaps as if it were 1.0. If you needed to preserve out-of-range values, this node will quietly trim them.
    • It swaps bounds if tgt_min > tgt_max. Want an inverted mapping (1.0 → low)? Just flip the targets; the node handles it instead of erroring.
    • Flat ranges are guarded. If the target range is zero-width it returns tgt_min rather than dividing by zero.

    Where it earns its place

    • Driving strength dials from a single control. Set a 0–1 slider somewhere upstream (a mask node's normalized output, a math node) and use this to fan it out to different ranges for different consumers - one knob, several remaps.
    • Converting mask values into sampler settings. Take the aggregated mask's peak value or an average and remap it to a CFG or denoise range for a conditional pass.
    • Sanity-ranged strength mapping. Map 0–1 to, say, 0.3–0.9 so a "weight" can never actually hit 0 or 1.

    The honest caveat

    It assumes your input is normalized. Feed it a 0–50 value and it clamps hard at 1.0, giving you constant output. If your source isn't 0–1, remap the source range first (or use the mask remap node, which handles arbitrary source ranges via PseudoMaskRemap's optional src_min/src_max). Different tool, different job.

    It's a small, unglamorous node - but in a pack where values bounce between lists, masks, and sampler settings, it's the kind of utility you'll reach for more than you expect. Install: clone Pseudotools/Pseudocomfy into custom_nodes and restart, or search "Pseudocomfy" in Manager.

    CategoryPseudocomfy/Utils

    Inputs (3)

    NameTypeDefaultDescription
    valFLOAT
    tgt_minFLOAT0.00
    tgt_maxFLOAT1.00

    Outputs (1)

    NameTypeDescription
    valFLOAT