Nodes/Elegant Nodes/Elegant Resolution Reroute
ComfyUI Node

Elegant Resolution Reroute

Carry Width and Height on a Single Wire

By wipeer·Created 2 months ago·Updated 22 days ago· 2
Elegant Resolution Reroute
  • resolution
  • width
  • height
  • resolution
  • text
◄width—►
◄height—►
◄text_outputfalse►

Width and height are the most annoying two-value pair in ComfyUI. Every Empty Latent Image, every upscaler, every crop wants both, so a workflow that resizes at three points has width and height wires snaking everywhere - and the moment you change the size you're re-dragging two links instead of one. Elegant Resolution Reroute collapses them into a single RESOLUTION link that carries both numbers, and splits them back apart wherever you need plain integers again.

It's the same idea as the context bus in ComfyUI's plumbing layer - bundle several values into one wire so the graph stays readable - except scoped to just a size, which makes it a lot less dangerous. A context object can hide which version of a model it's holding; a size can only be wrong in a way you'll notice.

The mechanism: it parses, then it overrides

There are two ways to give it a size, and they combine rather than compete.

The resolution input takes text or a RESOLUTION. The parser is deliberately forgiving: 1024x1024, 1024 x 1024, 1024 1024, 1024, 1024, 1024*1024, even (1024, 1024) all work, because it accepts a comma, semicolon, slash, asterisk, the × character, or just whitespace as the separator, and strips surrounding brackets. A single number is read as a square. What it refuses is 16:9 - and the error message is blunt about why: that's a ratio, not a size. (For ratios, use the pack's Resolution Selector, which outputs this same RESOLUTION type; the two are designed to chain.)

The width and height inputs are optional sockets that replace one side of whatever the resolution gave. That's the useful part in practice. Leave the text at 1024x1024, connect an INT to width, and you get your width with 1024 coming back out as the height. Want to turn a square into a 16:9-ish letterbox at the same width? Set width to 1344 and let height stay put. Only if both sides end up missing does the run stop, with "Give a resolution (like 1024x1024), or both a width and a height."

Outputs are width and height as INTs, resolution as the pack's RESOLUTION type, and text - the size as a string like 1024x1024. The text output is hidden until you flip the advanced text_output (⚙ in the title) switch on. Worth knowing: the string is computed regardless, the switch only shows or hides the socket, so turning it on never changes a value anywhere.

Where it earns its place

The obvious use is one node at the front of a workflow, fed by a text primitive or a Resolution Selector, and one at the back feeding an upscaler's target size - so a size is defined once and converted to integers only at the exact points something insists on integers.

The less obvious use is the split. text and width/height make this the natural place to fix a mangled size string coming out of some other node, or to turn a saved RESOLUTION back into two numbers for a node that predates the type. If you're doing tiled or two-pass upscaling, where the intermediate size has to be exact and often differs from the input by a weird factor, having one authoritative size object in the middle saves a lot of retyping.

Because resolution accepts a RESOLUTION and emits one, you can chain these nodes, which is either useful or a sign you should restructure your graph. Both are true sometimes.

Installing

ComfyUI Manager: search Elegant Nodes, install, restart, refresh the browser.

Or:

cd ComfyUI/custom_nodes
git clone https://github.com/wipeer/comfyui-elegant-nodes.git
pip install -r comfyui-elegant-nodes/requirements.txt

No models, no downloads, no VRAM. simpleeval is the only external Python package and ComfyUI already installs it. You need ComfyUI 0.4.0+ - this pack uses the V3 node API throughout, and custom types like RESOLUTION are part of that.

If Manager says it can't find the pack, it's the registry extraction issue the author notes in TODO.md, not your install. Clone by URL and it works.

The one trap

1024x1024 isn't a placeholder in the text field - it's the actual default, and it's live. So if you connect a width and forget about the field, you get your width and a height of 1024, silently. That's the override behaviour working exactly as designed, and it's also the most likely way to end up with a subtly wrong image size and no error to explain it. Whenever you connect one side, look at what the other side is inheriting.

Categoryelegant

Inputs (4)

NameTypeDefaultDescription
widthoptINTConnect a width. It replaces the width of the resolution.
heightoptINTConnect a height. It replaces the height of the resolution.
resolutionoptSTRING,RESOLUTION1024x1024Width and height as text: 1024x1024, 1024 x 1024, 1024 1024, 1024, 1024. One number is a square. You can also connect text or a RESOLUTION.
text_outputoptBOOLEANfalseShow the text output (the size as text, like 1024x1024).

Outputs (4)

NameTypeDescription
widthINT—
heightINT—
resolutionRESOLUTION—
textSTRINGThe size as text, like "1024x1024". Switch it on with text_output (advanced, ⚙).