jz Resolution Selector
The Resolution Selector You Can Actually Wire Into a Graph
- width
- height
Don't skip this because it sounds like a clone of ComfyUI's built-in node. jz Resolution Selector exists precisely because the core one has a hole: its aspect_ratio input is a COMBO, and ComfyUI refuses to connect a STRING output to a COMBO socket. If your aspect ratio comes from anywhere but your own hand on a dropdown - a calculated value, another node's output - the core node is a dead end. This fixes exactly that.
Why you'd reach for it
Most of the time you don't need a resolution node at all. You type 1024x1024 into an Empty Latent Image and move on. You need one when the dimensions shouldn't be a number you typed - the moment the target size depends on something else in the graph. In this pack's home turf that "something else" is jz Pad Calculator, which works out the exact size the Gemini image API can emit for an image you've fed it, outpainting-style. Its aspect_ratio output is a STRING, and the whole reason this node exists (read the source comment - it says so) is so you can wire that string straight into a node that turns it into usable width/height INTs. No manual retyping, no drift between what the API supports and what your latent is sized to.
How it works
This is a value node, not a pixel one - the plumbing layer of ComfyUI, where the job is fighting repetition and stale typed-in numbers. Pick an aspect ratio, get two integers out. Under the hood there are two ways to compute them, chosen by the mode widget:
table(default) looks the ratio up in a hardcoded dimension map - the sameDIMENSION_MAPthat jz Pad Calculator and jz Gemini Generate's dropdowns draw from, so they literally cannot disagree. Ten plain ratios (1:1through21:9, plus5:4/4:5that core's eight-ratio list doesn't even offer), each with a1K,2K, and4Ksize. Theresolutionwidget only matters here.megapixelsignores the table and uses the core Resolution Selector's own formula: scale the ratio so the result hits your target megapixels, then round each side to a multiple ofmultiple(default 8, so everything stays latent-friendly). This mode handles any ratio and any target from 0.1 to 16 MP.megapixelsandmultipleonly matter here.
The two deliberately disagree: 16:9 at 1 MP is 1376x768 in the table but 1368x768 by the formula. If a downstream API is going to reject a size it doesn't know, use table. If you just need a sane, divisible resolution, megapixels is the flexible one.
The inputs and outputs that matter
aspect_ratio- dropdown, defaults to1:1, plain ratios only.mode-tableormegapixels; this is the one you actually think about.aspect_ratio_in- the optional STRING socket that makes this node worth having. Wire it and it beats the dropdown. It'll even parse core's parenthesized form, so16:9 (Widescreen)fed in still resolves.- Outputs are
widthandheight, both INTs - wire them into an Empty Latent Image, jz Resize And Pad, or anything else that takes dimensions.
One thing that bites: the widgets that don't apply to your chosen mode are just ignored, not hidden, so it's easy to think resolution matters when you're in megapixels mode. It doesn't.
Installing it
Install the pack once - every node in the jz/ category comes with it. ComfyUI Manager: search comfyui-jz. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/j-zhang19/comfyui-jz
# restart ComfyUI
No model files to download for this node, and no API key - the Gemini/OpenRouter nodes in this pack need keys, this one doesn't touch the network. The whole pack is tiny (declared deps are just requests, pillow, numpy).
Common issues
The pack auto-discovers every node in nodes/, and it loads all-or-nothing: if any file fails to import, the whole jz/ category vanishes. The shared dimension table lives in pad_calculator.py, which imports scipy and torch at module load - so if the pack's nodes don't show up on a lean install, a missing scipy is the usual culprit (pip install scipy in your ComfyUI Python env). And if you wire in a ratio table mode doesn't know, it raises a clear error telling you to switch to megapixels - read it, it lists the ten ratios that work.
Honestly? If you hand-type every resolution anyway, the core node is fine and you don't need this. The day you build a workflow where the target size has to follow the input image - that's when the STRING socket earns its keep.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 1:1 | plain ratios, no parenthesised names — wire jz Pad Calculator's aspect_ratio into aspect_ratio_in to drive this from a graph |
| mode | COMBO | table | table = the exact dimensions Gemini emits; megapixels = core Resolution Selector's formula |
| resolution | COMBO | 1K | table mode only |
| megapixels | FLOAT | 1.00.1–16 | megapixels mode only — 1.0 MP is about 1024x1024 square |
| multiple | INT | 88–128 | megapixels mode only — each side is rounded to a multiple of this |
| aspect_ratio_inopt | STRING | overrides the dropdown when connected — e.g. jz Pad Calculator's aspect_ratio output |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |