SizeToWidthHeight
The boring node that turns a Size object into numbers you can actually use
- size
- Width
- Height
- LargeSide
- SmallSide
It only does one thing, and that's the point
SizeToWidthHeight is the least glamorous node in the pack and the one you'll reach for constantly once you use its parent. Its entire job: take the Size object that AspectRatioToSize produces and split it into four plain integers - Width, Height, LargeSide, SmallSide.
Why does that matter? Because ComfyUI's Empty Latent node (and every other node that wants dimensions) doesn't understand Size objects. That type is this pack's own little datatype. The only way to get real numbers out of AspectRatioToSize is to push its output through here. They're a pair: the calculator, then the unpacker.
How it works
There's no clever math - the source is literally a few lines. It reads width and height off the Size object, returns them, then adds max(width, height) as LargeSide and min(width, height) as SmallSide.
The LargeSide/SmallSide outputs are the quiet superpower. If your ratio is portrait, you don't have to think about which number is which - the node already told you the long and short edges. That's handy when you're reasoning about "the long edge is 1920" instead of "width equals… wait, is it 1080 or 1920?"
Inputs and outputs
One input, one thing to wire:
size- aSIZEobject, almost always straight fromAspectRatioToSize.
Four outputs, all INT:
Width,Height- the actual pixel dimensions.LargeSide,SmallSide- the same numbers, sorted.
Width and Height typically go into Empty Latent, an image resize, or any node that takes dimensions. The sorted outputs are there for when you need the long edge regardless of orientation.
Install
It ships in the same pack, so you get it the same way:
cd ComfyUI/custom_nodes
git clone https://github.com/sugarkwork/ComfyUI_AspectRatioToSize
Then restart ComfyUI - or search "AspectRatioToSize" in ComfyUI Manager and hit Install. No dependencies, no model files. The pack adds nothing beyond what ComfyUI already ships.
Where people get stuck
The one real confusion: a Size from a different pack won't connect here, and this node's outputs won't flow into a Size input. Custom types are matched by name inside ComfyUI, so only nodes from this pack speak SIZE. If you get a type-mismatch error wiring SizeToWidthHeight to something expecting a Size, that something is from another pack - check which nodes are actually connected. Otherwise there's no failure mode. It's a pure function: feed it a Size, get four ints, move on with your life.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| size | SIZE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| Width | INT | — |
| Height | INT | — |
| LargeSide | INT | — |
| SmallSide | INT | — |