Meux Smart Empty Latent
An empty latent that tells you the truth about its size
- latent
- gen_width
- gen_height
ComfyUI's built-in Empty Latent Image has a nasty habit: you type 1000×600, it silently creates a latent that isn't what you asked for, and you don't notice until the sampler or VAE complains. The built-in rounds to safe multiples, sure, but the size in your head isn't the size that comes out, and SDXL-class models increasingly want multiples of 64. MeuxSmartEmptyLatent is the version that tells you the truth: it rounds your target up to a safe value, builds the latent, and hands you the actual generated size on the side.
How it works
You give it a target size and an align (8 or 64). It rounds each dimension up - ceil(target / align) * align - so the generated latent is always at least as big as you asked, never smaller. It then creates a zero latent tensor at the VAE's actual resolution: each side divided by 8 (the standard downsampling for SD-family models), with your batch_size and 4 channels.
Inputs:
target_width/target_height- what you want, even awkward numbers like 1000×600.batch_size- how many empty latents to create in one tensor.align-8(bare minimum for a latent) or64(the default, and the safe choice for SDXL-class models).
Outputs:
latent- the empty LATENT, ready for the sampler.gen_width/gen_height- the actual generated pixel size, rounded up. Wire these into a text display or a downstream resize node so your sizing matches reality instead of your intention.
Installing it
Standard pack install:
cd ComfyUI/custom_nodes
git clone https://github.com/fchangjun/Comfyui_MultiSaveImage
cd Comfyui_MultiSaveImage
pip install -r requirements.txt
Or ComfyUI Manager → search "Baidu Meux ComfyTools" → restart.
Why it earns the "smart"
The rounding-up detail is the whole point. A latent that rounds down is a latent that crops your composition; rounding up means the image comes out slightly bigger, which you can then crop or resize exactly. And the gen_width / gen_height outputs close the loop - you never have to compute "wait, what size is this actually?" on a calculator again. If you're doing img2img or outpaint where a downstream node needs the real dimensions, those two INT outputs save you a whole custom node.
Honest caveat: if you always work in clean multiples of 64 anyway, this buys you nothing - the built-in node is fine. But the moment you work with odd target sizes, or you need to know the real dimension downstream, this is the version you want in the graph.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| target_width | INT | 1000 | — |
| target_height | INT | 600 | — |
| batch_size | INT | 1 | — |
| align | COMBO | 64 | 2 options: 8, 64 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| gen_width | INT | — |
| gen_height | INT | — |