math_Remap_data
Rescale a value into a new range, with easing
- value
- float
- int
Every workflow eventually needs a value that lives in one range translated into a different range - a frame index from 0 to 120 turned into a denoise strength from 0.2 to 0.8, a slider from -1 to 1 turned into a control weight from 0 to 2. That's math_Remap_data: a generic map() function as a node, with a curve applied to the interpolation instead of a flat straight line if you want one.
It's one of the data/math utility nodes in ComfyUI-Apt_Preset, sitting next to math_text_compare in the pack's Apt_Preset/data category. Pure arithmetic, nothing to install beyond the pack itself.
How it works
You tell it the range your input value actually lives in (source_min/source_max), the range you want it mapped to (target_min/target_max), and it does the proportional conversion - a value at 50% of the way through the source range lands at 50% of the way through the target range, by default. Where it goes past a basic remap is easing: instead of a straight linear mapping, you can pick from a long list of easing curves (sine, quart, cubic, circ, and more) that bias where along the target range the middle of your source range lands. That's the same vocabulary animators use for motion - ease-in starts slow and accelerates, ease-out starts fast and decelerates, ease-in-out does both. Applied to a diffusion parameter instead of a screen position, it means a value that ramps gently at first and then swings harder toward the end (or the reverse), instead of moving at a constant rate the whole way.
clamp decides what happens to inputs outside your stated source range: on, they get pinned to the target range's edges; off, they extrapolate past it, which can produce values outside target_min/target_max if your actual input ever exceeds the range you declared.
Inputs and outputs
- value (optional) - the number to remap. It's typed as a wildcard input, so you can feed it a float, int, or anything else that resolves to a number from another node - a frame counter, a slider, another node's numeric output.
- source_min / source_max - the range your input actually lives in. Default 0–1.
- target_min / target_max - the range you want out. Default 0–1 (i.e. does nothing until you change one side).
- easing - the curve applied to the interpolation. Leave it on
Linearunless you specifically want a non-uniform ramp. - clamp - whether out-of-range inputs get pinned to the target bounds instead of extrapolating past them.
It outputs both float and int versions of the same remapped result at once, so you can wire whichever type the downstream node actually wants without adding a separate conversion node.
Installing it
ComfyUI Manager: search "ComfyUI-Apt_Preset", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Restart after cloning. install.bat in the repo handles dependencies on Windows; on Linux/Mac, install from the requirements file in your ComfyUI venv the usual way. This node has no external model or file dependency of its own - it's math.
Common issues
Output is way outside the target range you set. You almost certainly left clamp off and your actual input value exceeded the source_min/source_max you declared - the node will happily extrapolate past your target bounds rather than silently correcting a mismatch. Turn clamp on if you want a hard ceiling/floor, or double-check the source range actually matches what's coming in.
Easing curve looks like it's doing nothing. Confirm you're actually looking at the right output - with target_min equal to target_max (or a source range of zero width), every easing curve collapses to the same flat result, since there's no range left to distribute the curve across.
Wired a value in but nothing changes downstream. Check that target_min/target_max actually differ from the defaults (0/1) - if you left them alone and your consuming node also expects a 0–1 range, the remap is a no-op by coincidence, not a bug.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| clamp | BOOLEAN | false | — |
| source_min | FLOAT | 0.00-9999–9999 | — |
| source_max | FLOAT | 1.00-9999–9999 | — |
| target_min | FLOAT | 0.00-9999–9999 | — |
| target_max | FLOAT | 1.00-9999–9999 | — |
| easing | COMBO | Linear | 23 options: Linear, Sine_In, Sine_Out, Sine_InOut, Sin_Squared, Quart_In, +17 |
| valueopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| float | FLOAT | — |
| int | INT | — |