βοΈ CR Clamp Value
Pin a number inside a min/max range
- a
- show_help
Clamping is the humble "keep this number between these two bounds" operation. If the input is below the minimum, you get the minimum; above the maximum, you get the maximum; in between, it passes through untouched. This node does exactly that, and it's the kind of thing you don't need until a value in your graph is coming from somewhere you don't fully control - a math node, a random generator, an interpolation - and you want to guarantee it stays sane.
It's from Comfyroll Studio (Suzie1 / RockOfFire), tucked in with the pack's other numeric utilities like Math Operation and Integer Multiple. Pure logic, no generation.
How it works
Three numbers in, one out. It compares a against range_min and range_max and returns whichever is in-range: min(max(a, range_min), range_max), if you want it in code. Nothing clever - but exactly the guardrail you want feeding a parameter that would misbehave out of bounds.
The inputs that matter
a- the value to clamp.range_min- the floor. Anything below this comes out as this.range_max- the ceiling. Anything above this comes out as this.
Output is the clamped value a (a FLOAT), plus the show_help link. A common use: a schedule or gradient node is driving a denoise strength or a ControlNet weight, and you clamp it to, say, 0.0β1.0 so a runaway calculation can't push it somewhere that breaks the sampler.
How to install it
- ComfyUI Manager: search
Comfyroll Studio, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes.git, then restart.
No models, no dependencies.
Common issues
Two things to keep straight. First, make sure range_min is actually less than range_max - set them backwards and the clamp bounds are nonsensical, so you'll get a constant instead of a passthrough and wonder why your value never changes.
Second, the output is a FLOAT. If the thing downstream demands an integer (a batch size, a step count, a width), you'll need a Float To Integer conversion in between - feeding a float into an int-only input either errors or silently rounds in a way you didn't choose. Comfyroll has a conversion node for exactly that. And note the default for all three inputs is 1, so a freshly-dropped node clamps 1 to [1,1] and returns 1 until you wire real values in - that's expected, not a bug. If the node's missing from your menu, that's the Comfyroll pack failing to load, a pack-level issue rather than this node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | FLOAT | 1.00-18446744073709550000β18446744073709550000 | β |
| range_min | FLOAT | 1.00-18446744073709550000β18446744073709550000 | β |
| range_max | FLOAT | 1.00-18446744073709550000β18446744073709550000 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| a | FLOAT | β |
| show_help | STRING | β |