Resolution Picker
SG Resolution Picker
- image
- width
- height
Some ComfyUI chores are worth a dedicated node, and "figure out what resolution I should generate at" is one of them. SG Resolution Picker (SG_ResolutionPicker) is a small utility that turns your raw width/height into properly snapped, aspect-correct, megapixel-scaled numbers - and it does the work live in the node UI, so you click buttons instead of reaching for a calculator. If you've pasted 1216x832 into Empty Latent Image for the fifth time today, this node is aimed at you.
Why is this even a chore? Because resolution is where a lot of bad output comes from. Every model has a native resolution - SD 1.5 at 512, SDXL at 1024 with a handful of trained aspect ratios, Flux happy anywhere divisible by 64, and the newer 2026 models tuned for a 1–2MP band. Go way outside that and you get duplicated anatomy, stretched bodies, tiling. The boring fix is staying in the native range, snapping to the grid, and picking a sane aspect ratio. This node makes that a button-click instead of a session with mental math.
How it works
It's one node with two INT outputs, width and height, that you wire into anything that wants dimensions - most commonly Empty Latent Image, but also resize nodes or a model's resolution input. The pipeline runs in a fixed order: aspect-ratio lock first, then megapixel scaling, then grid snapping last, so whatever comes out lands on a multiple of your snap value.
The "picker" part is a live preview driven by a small JS extension and a backend endpoint (/sg/process-resolution). Click a button - Snap, Scale to MP, or Apply AR - and the node computes the result and writes it straight back into the width/height widgets before you even queue a generation. Connect an image to the optional image input and it grabs that image's real pixel dimensions, so you can match your latent size to a reference or a ControlNet source. The UI even watches the upstream image and re-syncs when it changes.
The inputs that matter
- width / height (default 512) - your starting point; everything transforms from here.
- snap (default 64) with enable_snap on - the grid. 64 for Flux and SDXL, 8 if you want finer control. It rounds width first, then adjusts height to keep the ratio and rounds that, so the result is close to your aspect ratio but on-grid.
- target_resolution with enable_target_resolution - the megapixel target (1.0 = 1MP). It scales both sides by the square root of
target / current area, preserving aspect ratio. This is the killer feature if you're on a newer model that wants to live in a 1–2MP band. - aspect_ratio dropdown with enable_aspect_ratio - 21 built-ins covering 16:9, 21:9, 3:2, 5:4, and cinematic 1.85:1 / 2.39:1. Enable it and height gets forced from width.
- pick_closest_ar - ignores the dropdown and picks the list entry nearest your current dims.
- Optional custom_aspect_ratios - a comma-separated string like
1:1, 16:9, 21:9that swaps the dropdown's options for your own list.
Installing it
No dependencies, no model downloads. The project declares an empty dependency list and the whole thing is one Python file plus one JS file.
cd ComfyUI/custom_nodes
git clone https://github.com/sebagallo/comfyui-sg-resolution-picker
Then restart ComfyUI. Or skip the terminal: ComfyUI Manager → Install Custom Nodes → search "comfyui-sg-resolution-picker" (or "SG Resolution Picker") → Install.
Where people get tripped up
The image input overrides whatever you typed into width/height whenever it's connected. If your dims change against your will, an upstream image is dictating them - that's the feature, but it surprises people.
Remember the order of operations: AR lock applies before megapixel scaling before snap. Keep enable_target_resolution off unless you actually want it, because a 1.0MP target will quietly shrink a 1344x768 starting point that's already past a megapixel.
Finally, this node leans on ComfyUI's own server internals (PromptServer routes, comfy.comfy_types) for that live preview, so keep both the node and ComfyUI updated together. It's also a genuinely small pack with zero community footprint - you won't find much troubleshooting discussion out there. If the numbers look slightly off, it's usually snap rounding an odd ratio, which is the node being honest rather than broken.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 5120–16384 | — |
| height | INT | 5120–16384 | — |
| snap | INT | 641–1024 | — |
| enable_snap | BOOLEAN | true | — |
| target_resolution | FLOAT | 1.0000.001–256 | — |
| enable_target_resolution | BOOLEAN | false | — |
| aspect_ratio | COMBO | 1:1 | 21 options: 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, +15 |
| enable_aspect_ratio | BOOLEAN | false | — |
| pick_closest_ar | BOOLEAN | false | — |
| imageopt | IMAGE | — | |
| custom_aspect_ratiosopt | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |