HWP Get Side (X/Y)
Live longest-or-shortest from a width and a height
- side
The smallest useful node in the pack
HWP Get Side (X/Y) takes a width and a height and returns whichever is longer or shorter, selected by a toggle. That's the entire node: one max() or min() with a widget. It's so simple that the honest question is why it exists at all, and the answer is the same one that justifies half of ComfyUI's utility nodes - not the math, but making the math live.
Plenty of workflows have a number that should track a dimension but doesn't: "crop to the smaller side," "cap the short edge at 1024," "feed the longer edge into an upscale ratio." If you type that number in once and later change the resolution, you now have a stale constant silently driving downstream nodes. This node turns "the longer side" into a value that recomputes itself every time you touch width or height.
Inputs and output
- width, height - plain INTs, defaults of 512 each, range 1–32768. You can type them, or wire them from a source so they always match (an Empty Latent-style size, a primitive, a previous node's output). Wired in, the node becomes a true derived value instead of a manual echo of what you typed elsewhere.
- side - toggle between
longest(default) andshortest.
One output, side (INT), which feeds any integer input downstream - a scale target, a crop node's dimension, a math node computing steps or megapixels, a text display. After a run the value also shows as a bare number under the node, like the built-in Get Image Size node (that display needs a recent ComfyUI; older versions just skip it).
How it differs from its sibling
The pack ships this and HWP Get Side (Latent) side by side, and they answer the same question at different points in the graph. The Latent version measures an actual LATENT and converts from latent space (×8) to pixels, so it knows the real size of what a sampler produced. This one works on raw width/height integers you supply, so it's for when the dimensions are already known - sitting on your Empty Latent or a size node - but need to be turned into a computed choice that stays in sync. No ×8 here: these are already pixel numbers, don't double them.
A common shape to reach for it in: multi-stage or aspect-ratio logic where the smaller side sets the ceiling for a second pass and the larger side sets the upscale base. Whatever your graph's rule is, the point is the rule lives in the graph as a wire, not in your head as a memorized number.
Installation
Part of hwprinz/ComfyUI-HWP-Nodes - a four-node pack, MIT, zero Python dependencies, no models to download. Via ComfyUI Manager, search "ComfyUI-HWP-Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/hwprinz/ComfyUI-HWP-Nodes
Restart ComfyUI and it shows up as HWP Get Side (X/Y) under the HWP category. If this feels like a lot of ceremony for a max/min, that's fair - but once a size-dependent workflow is live, the few seconds this saves per resolution change add up fast.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 5121–32768 | — |
| height | INT | 5121–32768 | — |
| side | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| side | INT | — |