NH Smart Resolution Picker
The txt2img resolution node that already did the math
- width
- height
- latent
- info
- aspect_ratio
Picking a resolution for text-to-image feels like it should be trivial and is quietly the most annoying setup step in a workflow. The empty latent needs to be a size your model actually likes - divisible by the right number, within the model's supported range, with the right aspect ratio. NH Smart Resolution Picker is the node that says "pick a preset and stop worrying," and it's the txt2img companion to NH's image-resize nodes.
You set two things: model_family (FLUX.2 Klein 4B / FLUX.2 Klein 9B / FLUX.2 Dev / Qwen-Image / Z-Image) and a preset from a 28-option dropdown of the form 2 MP (sweet spot) ⭐ | 1:1 | 1408×1408. It spits out width, height, a ready-made latent (an empty tensor at the right size), info (a human-readable summary), and aspect_ratio. The default preset is the 2 MP sweet spot for FLUX.2 Klein 9B - 1408×1408 - which is the sensible starting point for that family.
What the node is actually doing
The presets come from a table in the pack that knows each model's constraints: a minimum and maximum resolution, a size multiple (16 for the FLUX family, 32 for Qwen-Image), and the latent channel count. The latent it builds is a real empty latent - zeros at batch_size × 16 × (height/8) × (width/8) - so you can wire it straight into a KSampler without a separate Empty Latent Image node. It also gives you aspect_ratio as a plain float, which is handy if a downstream node wants to compare or report the ratio numerically.
Three optional inputs add flexibility. swap_orientation flips width/height on the fly (portrait ↔ landscape) with a note in info. batch_size sets the number of latents, clamped 1–64. And use_custom with custom_width/custom_height bypasses the presets entirely - but here's where the node earns its keep: custom sizes get snapped to the model's multiple and clamped to its min/max, and both adjustments are reported in info. So you can type 1000×1000 and it'll quietly give you 1008×1000 (or whatever the multiple demands) instead of a latent that trips up the model later.
Where it sits in a workflow
This is a text-to-image node: it produces a latent, not a resized image. If you're starting from an existing image that needs to fit a model preset, you want NH Smart Ratio Image Resize instead, which picks the closest preset from the image's own aspect. Use this one when you're generating from scratch - swap preset or swap_orientation to iterate over aspect ratios without touching the rest of the graph.
Install
Part of NH-Nodes:
- ComfyUI Manager → search NH-Nodes → install → restart ComfyUI. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jetthuangai/NH-Nodes.git
cd NH-Nodes
pip install -r requirements.txt
Then restart ComfyUI.
No model downloads - it's pure math over a preset table.
Common issues
The info output is your diagnostic friend; read it when sizes look off. If a custom size "snaps" to something you didn't ask for, that's the multiple-of clamping working as intended. And if you're on a model not in the dropdown, there's no way to add it without editing the pack's data file - this node is presets-only, by design. One more: the latent is empty by definition, so don't expect to feed it into an image-conditioned workflow; it's for fresh generation.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model_family | COMBO | FLUX.2 Klein 9B | 5 options: FLUX.2 Klein 4B, FLUX.2 Klein 9B, FLUX.2 Dev, Qwen-Image, Z-Image |
| preset | COMBO | 2 MP (sweet spot) ⭐ | 1:1 | 1408×1408 | 28 options: 2 MP (sweet spot) ⭐ | 1:1 | 1408×1408, 1 MP | 1:1 | 1024×1024, 1 MP | 3:4 | 896×1152, 1 MP | 2:3 | 832×1216, 1 MP | 9:16 | 768×1344, 1 MP | 9:21 | 640×1536, +22 |
| use_customopt | BOOLEAN | false | — |
| custom_widthopt | INT | 102464–4096 | — |
| custom_heightopt | INT | 102464–4096 | — |
| swap_orientationopt | BOOLEAN | false | — |
| batch_sizeopt | INT | 11–64 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| latent | LATENT | — |
| info | STRING | — |
| aspect_ratio | FLOAT | — |