Nodes/ComfyUi-MpiNodes/Mpi Normalize Value
ComfyUI Node

Mpi Normalize Value

Map any range to any range, without the spreadsheet

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Normalize Value
  • value
  • normalized
input_min0.00
input_max100.00
output_min0.00
output_max1.00
clamptrue
mode

You have a 0–100 slider and a node downstream that wants a 0–1 float. Or a percentage that needs to become a CFG range. The math is boring - (value - min) / (max - min) * out_range + out_min - but typing it into a text box on every workflow is exactly how you make a typo at 1am. Mpi Normalize Value is that formula as a node: it remaps a value from an input range to an output range, optionally with a curve applied, and clamps the result so you never overshoot.

It's one of the quiet workhorses in the ComfyUi-MpiNodes pack from Mad Pony Interactive. The reason you'll reach for it over a hand-rolled expression is the mode dropdown - "remap to 0–1" is the default, but "remap with a log curve" or "invert it" is where hand-typing gets genuinely annoying.

How it works

The math is: normalize value to 0–1 against input_min/input_max, optionally run it through one of four transforms, then scale it into output_min/output_max. The modes:

  • linear - plain proportional mapping. 50 on a 0–100 scale becomes 0.5 out.
  • inverse - flips it. A big input becomes a small output. Handy for "closer = stronger" reversed relationships.
  • log / exp - apply a curve so mid-range values get compressed or stretched. Use these when a linear map makes your slider feel all-or-nothing.

clamp (on by default) pins the result inside the output range. Leave it on unless you genuinely want out-of-range values - for strength inputs, clamping is almost always what you want.

The value input is wildcard-typed, so you can type a number in the widget (default 50, 0–100) or wire an INT/FLOAT in from another node. Booleans get coerced to ints, which is a nice touch when a toggled output feeds straight in.

The gotcha

If input_min equals input_max, the node raises ValueError: Input range cannot be zero. - division by zero, politely refused. If you set both range ends to the same number, the graph will error instead of silently doing something dumb. That's the only real trap, and it's a sensible one.

The single output is normalized (FLOAT), ready to feed a strength, denoise, or any other 0–1 input.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

Restart ComfyUI and you're done - no extra dependencies. ComfyUI Manager users can search ComfyUi-MpiNodes instead of cloning by hand. The pack is AGPL-3.0 at current versions (MIT up to 1.2.6), which only matters if you're shipping derivative code.

Where it earns its keep

The classic case is converting a control slider into a sampler input: keep a 0–100 "strength" widget on the canvas, wire it through Mpi Normalize Value into the strength field of a LoRA or the denoise of a KSampler, and you never touch the raw 0–1 values again. The log mode is quietly great for denoise - linear denoise sliders feel dead at the low end, and a log curve gives you real control where the model actually responds.

CategoryMpiNodes/Math

Inputs (7)

NameTypeDefaultDescription
value*500–100
input_minFLOAT0.00
input_maxFLOAT100.00
output_minFLOAT0.00
output_maxFLOAT1.00
clampBOOLEANtrue
modeCOMBO4 options: linear, inverse, log, exp

Outputs (1)

NameTypeDescription
normalizedFLOAT