Nodes/ComfyUI 1hewNodes/Range Mapping
ComfyUI Node

Range Mapping

Turn a 0-1 slider into the range you actually need

By 1hew·Created about a year ago·Updated 7 days ago· 33
Range Mapping
    • FLOAT
    • INT
    value1.000
    min0.000
    max1.000
    rounding3

    Lots of ComfyUI inputs live on a 0-to-1 scale, and lots of things you actually want to control don't. Range Mapping is the tiny utility that rescales: feed it a 0–1 value, give it a min and max, and it hands back the value stretched onto that range. Boring, obvious, and once you've used it once you'll wonder why every workflow doesn't have one in the corner.

    What it's for

    It's the classic slider-scaler. A strength input on a node wants 0–1, but your experiment calls for strength in the 0.3–0.7 band - map the slider to that band so the full sweep of the widget covers a useful range instead of a dead zone. Or you're driving a parameter that expects real-world units (a delay in seconds, a resolution, an angle) from a normalized control. Anywhere a 0–1 float needs to become a different scale, this is the bridge. Because it outputs both a rounded FLOAT and an INT, you get the scaled number in whichever flavor the downstream node wants.

    How it works

    The math is a straight linear interpolation: min + value * (max - min). At value = 0 you get exactly min; at value = 1 you get exactly max; in between is proportional. Then rounding decides the precision - it rounds the float to that many decimal places, or, if set to 0, truncates to an integer. The INT output is always the integer form of the result.

    Nothing clever, nothing hidden. That's the appeal - a deterministic mapping you can reason about.

    The inputs that matter

    • value (FLOAT, 0–1, default 1) - the normalized input. Default 1, not 0, which trips people up: with default min/max of 0/1 it outputs 1.
    • min / max (FLOAT) - the output range. Can be negative or huge; the code's limits are essentially the float64 range.
    • rounding (INT, default 3) - decimal places on the FLOAT output; 0 makes it an integer.

    Outputs: FLOAT (rounded) and INT (integer form) - both from the same mapping.

    Installing it

    ComfyUI Manager → search ComfyUI-1hewNodes → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/1hew/ComfyUI-1hewNodes
    

    Restart ComfyUI. No models, no downloads - it's arithmetic. The pack installs heavyweight requirements regardless, and it targets ComfyUI's newer comfy_api.latest API, so update ComfyUI if nodes don't register.

    Common issues

    The two classic fumbles: forgetting that min and max define the output range, so leaving them at 0/1 and wondering why "nothing changed" - that's actually correct, you just haven't set a range. And the default value = 1 meaning the mapping outputs max until you touch it. If you want a slider that starts mid-range, either set value or compute your starting point accordingly. Rounding is applied to the output, not the slider - set it to a couple of decimals and you get smooth-enough steps for almost anything.

    Category1hewNodes/util

    Inputs (4)

    NameTypeDefaultDescription
    valueFLOAT1.0000–1
    minFLOAT0.000-18446744073709550000–18446744073709550000
    maxFLOAT1.000-18446744073709550000–18446744073709550000
    roundingINT30–10

    Outputs (2)

    NameTypeDescription
    FLOATFLOAT
    INTINT