Ratio Advanced (Mikey)
Every SDXL sizing number CLIP wants, from one node
- latent_w
- latent_h
- cte_w
- cte_h
- target_w
- target_h
- crop_w
- crop_h
SDXL's text encoder doesn't just want a width and height - it wants the latent size, a separate "clip text encoder" size, a target size, and crop coordinates, all as explicit conditioning inputs. Getting those four pairs of numbers right by hand, especially when you want them related but not identical (say, generating small and telling the model you're targeting something bigger), is exactly the kind of math nobody wants to do node-by-node. Ratio Advanced computes all eight numbers in one place.
How it works
The README calls this the "big brother" of the pack's simpler Preset Ratio Selector, and the extra size shows in the input list: it computes latent width/height, CLIP text-encoder width/height, and target width/height - plus crop coordinates - through three parallel, independently configurable groups. For each of the three (latent, CTE, target), you can pick a preset ratio from the dropdown, or go custom and set the numbers directly, or - this is the part that actually saves the math - feed a mult value to scale the latent's own dimensions up by that factor, a res value to fit the same aspect ratio into a target resolution budget, or a fit_size value to cap the largest dimension while preserving ratio. Those three methods (mult, res, fit_size) are alternate ways of deriving the CTE and target sizes from the latent size you already picked, rather than typing three separate width/height pairs by hand.
There's also a preset field pulling from 21 recommended SAI resolutions bundled with the pack (contributed by community member masslevel, per the README), and use_preset_seed - flip it on and the seed input picks which preset gets used, the same seed-as-index pattern this pack reuses in its Range nodes, useful if you want a workflow that cycles through several resolutions automatically across queued runs.
The inputs and outputs that matter
preset- one of 21 bundled SAI-recommended resolutions, or leave asnone.swap_axis- rotates the whole result 90 degrees (portrait ↔ landscape) without re-entering any numbers.select_latent_ratio/custom_latent_w/custom_latent_h- the base generation size. Pick a preset ratio, orcustomand type your own.select_cte_ratio/cte_w/cte_h/cte_mult/cte_res/cte_fit_size- SDXL's CLIP text encoder conditioning size, derivable from the latent size via whichever ofmult/res/fit_sizeyou fill in.select_target_ratio/target_w/target_h/target_mult/target_res/target_fit_size- same idea for the target-size conditioning.crop_w/crop_h- crop coordinate conditioning.use_preset_seed/seed- cycle through presets by seed instead of the dropdown.- Outputs:
latent_w,latent_h,cte_w,cte_h,target_w,target_h,crop_w,crop_h- all plain INT, ready to wire into an EmptyLatentImage and a CLIPTextEncodeSDXL. Note there's no LATENT output here - this node computes numbers, it doesn't build the empty latent for you.
How to install it
Bundled with the rest of Mikey Nodes. ComfyUI Manager: search "Mikey Nodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/bash-j/mikey_nodes
then restart. For ratios or presets beyond the built-ins, the README's mechanism is a hand-created user_ratios.json or user_ratio_presets.json in your ComfyUI root - neither file ships with the pack.
Common issues & troubleshooting
Custom ratios or presets not appearing. Both extra JSON files have to exist in the ComfyUI root and be created by you, in the exact shape the README documents. If you haven't made one, you'll only see the built-in 15 latent ratios and 21 presets - that's expected, not broken.
On a hosted ComfyUI, hand-placed JSON files don't persist. Same caveat as the pack's style-file mechanism: a serverless or hosted executor that doesn't retain a persistent filesystem between runs won't keep a user_ratios.json you dropped in manually. Stick to the built-in presets unless your hosting setup gives you a way to persist files into the container.
CTE or target numbers come out identical to the latent size. Check that you actually filled in a mult, res, or fit_size value, or picked a different ratio for that group - left at their zero defaults with select_cte_ratio/select_target_ratio on custom, nothing derives automatically.
No latent output. This node is sizing math only. Wire its latent_w/latent_h outputs into a separate EmptyLatentImage node - Ratio Advanced doesn't build the latent itself.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| preset | COMBO | none | 21 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), +15 |
| swap_axis | COMBO | false | 2 options: true, false |
| select_latent_ratio | COMBO | 1:1 [1024x1024 square] | 16 options: custom, 1:1 [1024x1024 square], 8:5 [1216x768 landscape], 4:3 [1152x896 landscape], 3:2 [1216x832 landscape], 7:5 [1176x840 landscape], +10 |
| custom_latent_w | INT | 00–8192 | — |
| custom_latent_h | INT | 00–8192 | — |
| select_cte_ratio | COMBO | 1:1 [1024x1024 square] | 16 options: custom, 1:1 [1024x1024 square], 8:5 [1216x768 landscape], 4:3 [1152x896 landscape], 3:2 [1216x832 landscape], 7:5 [1176x840 landscape], +10 |
| cte_w | INT | 00–8192 | — |
| cte_h | INT | 00–8192 | — |
| cte_mult | FLOAT | 0.000–100 | — |
| cte_res | INT | 00–8192 | — |
| cte_fit_size | INT | 00–8192 | — |
| select_target_ratio | COMBO | 1:1 [1024x1024 square] | 16 options: custom, 1:1 [1024x1024 square], 8:5 [1216x768 landscape], 4:3 [1152x896 landscape], 3:2 [1216x832 landscape], 7:5 [1176x840 landscape], +10 |
| target_w | INT | 00–8192 | — |
| target_h | INT | 00–8192 | — |
| target_mult | FLOAT | 0.000–100 | — |
| target_res | INT | 00–8192 | — |
| target_fit_size | INT | 00–8192 | — |
| crop_w | INT | 00–8192 | — |
| crop_h | INT | 00–8192 | — |
| 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 | — |