Nunchaku Resolution Selector
The canvas picker that hands Flux the 16-channel latent it actually needs
- width
- height
- hires_width
- hires_height
- latent
- info
If you've ever built a Flux workflow from an SDXL template and hit a "latent shape mismatch" error, this is the node that quietly fixes it. Nunchaku Resolution Selector is, at heart, a fancy version of ComfyUI's core Empty Latent Image - except it produces the right latent for Flux. It hands you a canvas size, an empty 16-channel latent, and a pair of hires dimensions, all consistent with each other.
Here's the part that trips everyone up the first time: the core Empty Latent Image node in ComfyUI makes a 4-channel latent, which is correct for SD1.5/SDXL but wrong for Flux. Flux's VAE works on a 16-channel latent. Feed it a 4-channel one and you get shape errors or, worse, silently garbage output. That's why Flux-oriented packs ship their own resolution helpers, and this is this pack's version. It isn't a LoRA node at all, despite the pack name - it's just a convenience you get for free.
How it works
Flip the mode widget to Preset and you get 28 aspect presets that follow the Flux1 vocabulary - the same ratio set as the ControlAltAI Megapixel Calculator, which the author clearly borrowed from. They're sized at 1.0 MP and divisible by 64 (e.g. 4:5 (Artistic Frame) (896x1088)), with "High" variants at 1.5 MP for when you want bigger canvases. The WxH is embedded right in the label, and the node regexes it out. If parsing somehow fails, it falls back to custom_width / custom_height.
Under the hood it's dead simple: torch.zeros([batch, 16, height//8, width//8]), placed on ComfyUI's intermediate device. Flux's VAE downsamples 8×, so a 1024×1024 canvas becomes a 128×128 latent. The hires sizes are round(width * hires_scale) with a floor of 16, snapped to a multiple of 8 - so a 1.3× scale on 896×1088 gives you 1160×1416, not the exact product. Worth knowing if you're pedantic about exact hires dimensions.
The inputs and outputs that matter
mode-Preset(dropdown) orCustom(your owncustom_width/custom_height, both stepped by 8).preset- the aspect list. This is the one you'll actually touch.hires_scale- default 1.3, multiplier for the second-pass sizes. Range 0.1–8.batch_size- how many empty latents you get.
Outputs: width/height (your canvas), hires_width/hires_height (for the upscale pass), latent (the empty 16-channel tensor - wire this straight into your KSampler), and info (a one-line string summarising everything, handy for debugging). Note the hires outputs are just integers - they're for whatever node you resize/crop with before the second pass, not a second latent.
Installing it
Via ComfyUI Manager: search for ComfyUI-NunchakuFluxLoraStacker and install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/ussoewwin/ComfyUI-NunchakuFluxLoraStacker.git
Then restart ComfyUI. No model downloads needed for this node - it only needs torch, which you already have. The pack's other nodes (the LoRA stackers, Florence-2, CCSR) pull in heavy deps like nunchaku, transformers, and peft, but the resolution selector itself doesn't care. It's registered unconditionally, so it even works on AMD/ROCm setups where nunchaku can't import - the pack deliberately guards those imports so a missing nunchaku install doesn't take down the whole thing.
Common issues
- Still using the core Empty Latent Image out of habit. That 4-vs-16 channel difference is the classic Flux beginner trap, and this node exists specifically to avoid it.
- Hires dimensions not matching expectations. The multiple-of-8 snap means
hires_scaleis approximate, not exact. Nothing's broken. - Wrong canvas → OOM or slow. The "High" presets are 1.5 MP; if your GPU struggles with Nunchaku-quantized Flux, start at the 1.0 MP presets. Nunchaku itself is real and fast on 3090/4090-class cards, but getting it installed (CUDA 12.8, Windows portable setups) is famously fiddly - that pain is upstream of this node, not caused by it.
It's a small utility, but in a Nunchaku Flux graph it's the difference between copy-pasting sizes between three widgets and having one node that keeps everything in sync. For that, it earns its spot in the pack.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Preset | 2 options: Preset, Custom |
| preset | COMBO | 4:5 (Artistic Frame) (896x1088) | 28 options: 1:1 (Perfect Square) (1024x1024), 2:3 (Classic Portrait) (832x1216), 3:4 (Golden Ratio) (896x1152), 3:5 (Elegant Vertical) (768x1280), 4:5 (Artistic Frame) (896x1088), 5:7 (Balanced Portrait) (832x1152), +22 |
| custom_width | INT | 102416–8192 | — |
| custom_height | INT | 128016–8192 | — |
| hires_scale | FLOAT | 1.300.1–8 | — |
| batch_size | INT | 11–64 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| hires_width | INT | — |
| hires_height | INT | — |
| latent | LATENT | — |
| info | STRING | — |