Maximum
The 'At Least This Big' Guardrail for Resolutions and Batches
- values
- MATCHTYPE
UC_MathMax returns the largest of the numbers you connect to it. It sounds too trivial to mention, and then you realize it's the cleanest way in ComfyUI to say "at least this big" - which is a thought you have constantly about resolutions, batch sizes, and any quantity with a minimum you refuse to go under.
Why you'd reach for it
Two jobs, really. The guardrail: max(computed_value, 512) guarantees a resolution or dimension never dips below 512, no matter what the formula upstream says. The picker: max(option_a, option_b) picks the bigger of two candidates, which is handy when a value can come from more than one source and you want the larger. Both read better as a named node than as a hand-rolled formula, and legibility is a real currency in a graph with forty nodes - the knowledge base's node-plumbing essay makes exactly that point about utility nodes fighting for readability.
How it works
The input is an autogrow socket (values) that expands from 2 up to 10 connections as you drag in more wires, and the node runs plain max() over them. The output uses the pack's MatchType template, so it mirrors the input type - ints in, int out; a float anywhere makes the result a float. That means you can wire the result into the same kind of socket you fed it, no conversion.
The input that matters
Just values. Add as many as you need. There's no minimum-value widget baked in - you provide the floor yourself by wiring a constant or another node's output in as one of the operands.
Installing it
Part of ComfyUI-UtilsCollection. ComfyUI Manager → search "ComfyUI-UtilsCollection" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart. No model downloads; the pack's requirements are only opencv-python and typing-extensions.
What to watch for
Max and its sibling UC_MathMin are the same shape - if you've learned one you've learned both, and they're the natural pair for "keep it in range." The one thing people mix up: max sets a lower bound, min sets an upper bound. max(x, 512) means "at least 512"; if you want "never more than 512," that's UC_MathMin. Get that backwards and you've built a workflow that behaves the opposite of what you intended, and it's the kind of bug that's hard to spot because everything "looks fine." If you're migrating from ComfyUI-LogicMath, this replaces its max node - accept the swap, remove the old pack. Simple, typed, and exactly the guardrail you meant.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| values | COMFY_AUTOGROW_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |