ComfyUI Node

Number Remap

Move a number from one scale to another without thinking

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
Number Remap
    • remapped
    value0.50
    from_min0.00
    from_max1.00
    to_min0.00
    to_max100.00

    Somewhere in almost every ComfyUI workflow there's a value on the wrong scale: a strength stuck at 0–1 that needs to be a 0–100 percentage, a 512–1024 width that needs to be a 0–1 factor, a raw number that needs normalizing. Number Remap is the node that translates between scales linearly. It's "map a value from one range to another" - the formula behind normalized_value * (to_max - to_min) + to_min, minus the homework.

    It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. Zero models, zero GPU - this is arithmetic in a wrapper.

    How it works

    Five required inputs, all FLOATs:

    • value - the number you're translating (default 0.5)
    • from_min and from_max - the range value currently lives in (defaults 0 and 1)
    • to_min and to_max - the range you want it in (defaults 0 and 100)

    One output: remapped (FLOAT).

    The math: first it normalizes the value to 0–1 by subtracting from_min and dividing by the span ((value - from_min) / (from_max - from_min)), then it stretches that 0–1 onto the target range (to_min + normalized * (to_max - to_min)). Because it's linear, 0.5 in a 0–1 range becomes 50 in a 0–100 range - the README's example.

    The obvious use cases

    • 0–1 to 0–255 for color work, or the reverse.
    • Normalizing a value for a model. Many sampling parameters want 0–1; if you're computing a CFG or weight in arbitrary units, remap it into the range the consumer expects.
    • Percent to fraction and back - it's the two-way street: remap from 0–100 to 0–1 as easily as the other direction.
    • Cleaning up after math. Pair it with Number Clamp (same pack) to both rescale and pin the result to a valid window.

    Installing it

    The whole pack installs in one shot. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
    

    Then restart ComfyUI. Requirements are numpy, torch, and opencv-python - all already present in stock ComfyUI - and there are no model files to fetch. Search carefully: "DebugPadawan's ComfyUI Essentials" is a different, smaller pack than cubiq's "ComfyUI Essentials," which is in maintenance mode.

    Gotchas

    • If from_min equals from_max, the node raises a ValueError - you can't normalize over a zero-width range. That's the main way this node fails, and it fails loudly rather than silently, which is honestly polite.
    • It extrapolates, it doesn't clamp. A value of 1.5 in a 0–1 source range happily remaps to 150 in a 0–100 target. If you need to pin outliers, chain a Number Clamp after it.
    • Linear only. This won't do easing curves or log scales; for those you're into custom-node territory.
    • It always outputs FLOAT, so a node demanding INT needs a conversion step (the pack has one).
    CategoryDebugPadawan/Number

    Inputs (5)

    NameTypeDefaultDescription
    valueFLOAT0.50
    from_minFLOAT0.00
    from_maxFLOAT1.00
    to_minFLOAT0.00
    to_maxFLOAT100.00

    Outputs (1)

    NameTypeDescription
    remappedFLOAT