Integer Minimum
Take the smaller of two whole numbers
- INT
JWIntegerMin takes two integers and outputs whichever is smaller. That's it - min(a, b) as a node. Unexciting on its own, genuinely handy the moment you need to cap a value.
The classic case: you have a computed size or count that could get too big, and you want to clamp it to a ceiling. Feed the computed number in as a, your maximum as b, and the output is guaranteed never to exceed the limit. "Use the requested frame count, but never more than what's actually available." "Resize to this size, but don't go past 1024." Anywhere a value has an upper bound, this node enforces it without a scripting node.
How it works
Two integers go in, the node compares them and emits the lesser one. min(600, 1024) → 600. min(2000, 1024) → 1024. If they're equal, you get that value. No rounding, no side effects - a pure comparison.
The inputs and outputs that matter
a(INT) - first number, default0.b(INT) - second number, default0.- Output:
INT- the smaller of the two.
The two inputs are symmetric - it doesn't matter which is a and which is b, the result is the same. Wire one from a computed value and the other from a constant (a JWInteger holding your cap works nicely).
How to install it
Part of jamesWalker55/comfyui-various, a pack of small utility nodes.
- ComfyUI Manager: search "Various ComfyUI Nodes by Type", install, restart. Red node in a downloaded workflow? Install Missing Custom Nodes.
- Manually:
Restart afterward. No models, no dependencies.cd ComfyUI/custom_nodes git clone https://github.com/jamesWalker55/comfyui-various
Under the jamesWalker55 category after restart.
Common issues
- You wanted the larger value, not the smaller. This node only does minimum. The pack also ships JWIntegerMax for the opposite - if you're clamping a floor instead of a ceiling, that's the one you want. (It won't necessarily be visible unless you installed the whole pack; clone the repo or grab the primitive-ops file.)
- You need to clamp both a floor and a ceiling. Chain them: run the value through JWIntegerMin against your max, then JWIntegerMax against your min (or vice versa). Two nodes gives you a full clamp.
- Floats won't connect. This is integers only. Convert a float with JWFloatToInteger first, or look for the float-min node in the pack.
- Node is red / missing. The pack isn't installed. Install via Manager or clone the repo, then restart.
It's a small primitive, but capping a runaway value is exactly the kind of thing that's annoying to do any other way in a node graph. This makes it one wire.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0-18446744073709550000–18446744073709550000 | — |
| b | INT | 0-18446744073709550000–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |