Preset Ratio Selector (Mikey)
Pick an SDXL resolution and get all 8 numbers you actually need
- latent_w
- latent_h
- cte_w
- cte_h
- target_w
- target_h
- crop_w
- crop_h
If you've ever wired up an SDXL workflow by hand, you know the annoying part isn't picking a resolution - it's that SDXL's conditioning needs four pairs of width/height, not one. Your latent needs a width and height. The Clip Text Encode (SDXL) node wants a separate width/height (the "size the model thinks it's generating at" hint), a target width/height (usually the same or larger), and crop coordinates. Get any of those out of sync with your actual latent size and you get the classic SDXL weirdness - soft detail, odd cropping behavior, compositions that don't match what you asked for. Preset Ratio Selector exists to make that whole mess a single dropdown.
Pick a preset from select_preset - the pack ships with a big list (twenty-plus entries) built from a ratio_presets.json file contributed by a community member (masslevel, per the README), covering the officially recommended SAI resolutions with correctly matched clip-text-encoder and target sizes already worked out. You don't have to know SDXL's trained aspect ratios by heart; they're baked into the choices. It outputs eight integers in one shot: latent_w, latent_h, cte_w, cte_h, target_w, target_h, crop_w, crop_h - wire all eight to their matching slots on your Empty Latent Image and Clip Text Encode (SDXL) nodes and you're done.
Two extra controls worth knowing: swap_axis rotates the whole selection 90 degrees, so you don't need separate portrait and landscape entries in the list - pick your ratio, flip the axis if you want it tall instead of wide. And use_preset_seed, paired with the seed input, lets the node pick a preset based on the seed number instead of you choosing manually - useful if you're batch-generating and want resolution variety that's still reproducible per seed, rather than randomizing it separately.
You can also add your own entries via a user_ratio_presets.json file you create yourself in ComfyUI's root directory - the README shows the exact JSON shape expected.
Installing it
Install the whole Mikey Nodes pack - there's no per-node install. Through ComfyUI Manager, search "Mikey Nodes." Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/bash-j/mikey_nodes
Restart ComfyUI. No models or extra dependencies required - this node is pure arithmetic and JSON lookup, and the ratio_presets.json file it reads ships inside the repo itself.
Common issues
The most common mistake is only wiring up some of the eight outputs - say, just latent_w/latent_h into your Empty Latent, while leaving the Clip Text Encode's own width/height/target fields at their node defaults instead of the matching preset values. That defeats the point of the node; SDXL's conditioning wants those numbers to agree with your actual generation size, and mismatches are exactly the kind of subtle-but-real quality hit that's easy to miss because nothing throws an error, the image just looks a bit worse than it should.
The other one: if you go looking for user_ratio_presets.json expecting it to already exist, it won't - you have to create it yourself in ComfyUI's root folder, following the format in the README. Skipping that step just means select_preset only shows the built-in list, which is usually plenty, but it's worth knowing the customization path exists if you have a specific resolution you keep re-typing elsewhere.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| select_preset | COMBO | none | 20 options: 1024x1024 (AR 1:1 / DEC 1.0:1), 1024x960 (AR ~1:1 / Near 16:15 / DEC 1.07:1), 1088x896 (AR ~4:3 / Near 17:14 / DEC 1.21:1), 1088x960 (AR ~4:3 / Near 8.5:7.5 / DEC 1.13:1), 1152x832 (AR ~4:3 / Near 18:13 / DEC 1.38:1), 1152x896 (AR ~4:3 / Near 4.5:3.5 / DEC 1.29:1), +14 |
| swap_axis | COMBO | false | 2 options: true, false |
| use_preset_seed | COMBO | false | 2 options: true, false |
| seed | INT | 00–18446744073709550000 | — |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| latent_w | INT | — |
| latent_h | INT | — |
| cte_w | INT | — |
| cte_h | INT | — |
| target_w | INT | — |
| target_h | INT | — |
| crop_w | INT | — |
| crop_h | INT | — |