Meux Size Preset Node
Round your generation size up so the latent doesn't explode
- gen_width
- gen_height
- batch_size
- target_width
- target_height
Diffusion models are picky about dimensions in a way that isn't obvious until it bites you. Ask SDXL for a 1001×601 image and you'll get something mangled or an outright error, because the model expects sizes aligned to a multiple of 8 (and most workflows run on 64). MeuxSizePresetSafe is a two-input, one-math-operation node that exists to never let you generate at an unsafe size again: it rounds your target width and height up to the nearest multiple you choose and hands back the safe numbers.
How it works
It's pure integer math - no latent, no image processing, nothing loaded. You give it a target size and an alignment value, and it computes:
gen_width = ceil(target_width / align) * align
gen_height = ceil(target_height / align) * align
align is the 8 or 64 dropdown, defaulting to 64. Always rounds up, never down - rounding down would produce a canvas smaller than your target and crop content you wanted. The output then passes your original target back out untouched, alongside the aligned values, so the node doubles as a "single source of truth" for a size that multiple downstream nodes can all read from without you retyping it.
Why 64 by default? It's the conservative choice that's safe across SD 1.5, SDXL and most Flux workflows, and it keeps latent dimensions clean through the VAE. 8 is the loose option for when you're on a model that's fine with minimal alignment and you want to waste as little canvas as possible. Pick 64 unless you know your model's requirement is looser.
Inputs and outputs
Three numbers in, five out:
target_width/target_height- what you actually want (both capped at 4096, per the pack's safety policy).batch_size- passed through unchanged.align-8or64.- Outputs:
gen_width,gen_height,batch_size, plustarget_widthandtarget_heightpassed through.
How you actually use it
The typical wiring: compute the safe size here, feed gen_width and gen_height into an EmptyLatentImage, generate, and later crop back down to your true target - the pack's own MeuxSmartExactResize and MeuxAdvancedImageCrop are built for exactly that last step. The whole point is that your generation runs at a safe size while your intent stays the odd-looking number you actually wanted. It also means you can change one target value and every downstream node that reads from here updates with it.
Installing it
It ships in the BaiduMeux ComfyTools pack:
cd ComfyUI/custom_nodes
git clone https://github.com/fchangjun/Baidu_Meux_ComfyTools.git
cd Baidu_Meux_ComfyTools
pip install -r requirements.txt
Restart ComfyUI, or install via ComfyUI Manager by searching "Baidu Meux ComfyTools".
The honest take
This is a genuinely thin utility - a calculator with a ComfyUI face. For the cost of installing the pack (and its heavyweight shared requirements), you get something you could replicate with a single "expression" math node. The real value is the convention: one consistent node that every size-consuming part of a workflow points at, so nobody hardcodes a weird number and forgets where it came from. If you already have a size-management habit, skip it. If you keep generating at unsafe sizes because you forget, this is the node that fixes it for you.
One gotcha: the 4096 cap on inputs is hard - the pack clamped size-related inputs at 4096 in v1.4.0. If you're planning a genuinely huge canvas, this node won't let you; that's by design, and the error will tell you exactly that.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| target_width | INT | 10001–4096 | — |
| target_height | INT | 6001–4096 | — |
| batch_size | INT | 11–4096 | — |
| align | COMBO | 64 | 2 options: 8, 64 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| gen_width | INT | — |
| gen_height | INT | — |
| batch_size | INT | — |
| target_width | INT | — |
| target_height | INT | — |