Nodes/DemonAlone-JS_Addon-ComfyUI/Resolution Selector [BETA]
ComfyUI Node

Resolution Selector [BETA]

Stop Doing Aspect-Ratio Math in Your Head

By DemonAlone·Created 2 months ago·Updated about 21 hours ago· 1
Resolution Selector [BETA]
  • image
  • width
  • height
width1024
height1024
step_size16
resolution_preset1:1 Square (1024×1024)
priority_modeStrict Step (Snap to Grid)
scale_mult1.0
scale_mp1.0
align_to_stepfalse

Every workflow eventually needs two integers, and every workflow gets them wrong at least once. You want 16:9, you type something that isn't a multiple of 8, and the sampler hands you back an image a few pixels off from what the node told you. Or you nail 1344×768 for the first pass and then want the same ratio at double size for a hires pass, and now you're doing arithmetic in the width field at 1am.

DA_ResolutionSelector - display name "Resolution Selector [BETA]" - is a dimensions calculator with a socket on it. You pick a ratio preset, snap to a grid, scale by multiplier or by target megapixels, and it emits clean width and height INTs you wire into whatever builds the latent.

What it is, in the wider workflow

This is a value node, not a pixel node. It sits in the same family as ComfyUI's own PrimitiveInt: one authoritative source for a number, so the sampler, the latent builder and your upscale pass can't quietly disagree. The difference is that this one does ratio math for you.

That matters more than it sounds, because resolution is where a lot of "the model is broken" complaints come from. SDXL has a short list of trained ratios (1024×1024, 1152×896, 1216×832, 1344×768, 1536×640, and their rotations) and going off it gets you stretched bodies and doubled heads. Flux wants multiples of 64. Most 2026 models are looser - they take anything in a 1–2MP band and degrade softly instead of duplicating anatomy, which is exactly why the megapixel field here is useful. Z-Image gets ugly past about 2MP; that's a scale_mp of 2, not a guess.

How it works, honestly

Read the Python and it's a shock: almost nothing happens there. apply_scaling snaps width and height to the grid only when align_to_step is on and priority_mode is "Strict Step", clamps the floor at 64, and returns the two ints. Presets, multipliers and megapixel targeting do not execute at queue time at all.

They live in the JavaScript side of the node, and they work by writing values into the width and height widgets. Pick a preset and the JS commits the preset's numbers into width/height, then resets the dropdown back to "Custom / None" 50ms later. That reset has confused people - the dropdown snapping back looks like the preset failed, when it already landed in the fields.

scale_mult and scale_mp work the same way: they're previews plus buttons, not live scaling. Set scale_mp to 2 and nothing moves until you click Apply Megapixels (MP). Deliberate design - the info blocks show Preview -> Mult: 2688×1536 (4.13 MP) so you can see it before committing - but it catches everyone once.

The inputs that matter

  • width / height - plain INTs, 64 to 32768, and the real output of the node. Everything else here just moves these two numbers.
  • resolution_preset - twelve entries, "Custom / None" plus the standard portrait and landscape ratios (3:4, 4:5, 5:12, 7:9, 9:16, 13:19, 3:2, 4:3, 16:9, 21:9). A convenience, not state.
  • align_to_step / step_size - the trap. align_to_step defaults to False, so step_size: 16 does nothing on its own. Flip the boolean, then pick your divisor (1/4/8/16/32/64/128/256 - 64 for Flux, 8 if you're on SD1.5-era latent math).
  • priority_mode - "Strict Step (Snap to Grid)" or "Strict Aspect (Preserve Ratio)". Strict Aspect skips snapping entirely, which protects your ratio at the cost of handing the sampler whatever integer you asked for. Useful for a 2.35:1 cinematic look, not the one you want by default.
  • scale_mult / scale_mp - the two multipliers, applied by their buttons. scale_mp is the one worth keeping: 0.35MP is the recommended pre-upscale input for SeedVR2, and 1.0–2.0 is where most modern models live.
  • image - optional, and only used by the Read Image Resolution button, which looks at the resolution of whatever feeds it and copies it into width/height. You don't need to wire it for the node to work.

The buttons are the actual interface: Read Image Resolution, Swap Width / Height, Apply Multiplier, Apply Megapixels.

Outputs

Two INT sockets, width and height. Right-click the width field on an Empty Latent Image (or EmptySD3LatentImage, or a second-pass latent node) and choose Convert widget to input, then wire these in. One selector can feed the first-pass latent and a hires/upscale pass; change the ratio once, both follow.

Installing it

Open ComfyUI Manager, search DemonAlone-JS_Addon-ComfyUI, install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/DemonAlone/DemonAlone-JS_Addon-ComfyUI

Restart ComfyUI. There is no requirements.txt in the pack and no compiled dependency to build - the JS files are served from the pack's web/ directory and load with the frontend. The pack's other nodes (video maker, preset primitives, controllers) come along for the ride; this one works fine standalone. It's the companion to DemonAlone-nodes-ComfyUI but doesn't require it.

Where people get burned

The node's presets and buttons are frontend code, so if you update the pack and the browser serves a cached frontend, the node loads as a bare passthrough and the preset dropdown does nothing at all. Hard-refresh the browser (Ctrl+F5) after any update.

Second: because Strict Aspect mode disables snapping, you can push a non-multiple-of-8 size into a latent node. ComfyUI's own latent builders floor that with integer division, so the image you get back is a few pixels smaller than what the selector says. If your dimensions and your output file don't match, that's why - turn on align_to_step and use 8 or 16.

Third: the preset dropdown resetting to "Custom / None" isn't a bug. Check the width and height fields; the numbers are there.

Categoryutils/resolution

Inputs (9)

NameTypeDefaultDescription
widthINT102464–32768
heightINT102464–32768
step_sizeCOMBO16Divisor to snap dimensions to a multiple of this value (e.g., 16).
resolution_presetCOMBO1:1 Square (1024×1024)Quick base resolution preset.
priority_modeCOMBOStrict Step (Snap to Grid)Choose whether step alignment or exact aspect ratio takes precedence.
scale_multFLOAT1.00.1–4Uniform multiplier applied directly to width and height.
scale_mpFLOAT1.00.1–16Target megapixel count.
align_to_stepBOOLEANfalseIf True, snaps dimensions to step_size.
imageoptIMAGE

Outputs (2)

NameTypeDescription
widthINT
heightINT