Optimal Empty Latent (Advanced)
The same great size-picker, now with a Custom knob for models the presets forgot
- Latent
- Width
- Height
- Block Size
- Details
Optimal Empty Latent (Advanced) is the same node with the training wheels off. Same core idea: type an aspect ratio, pick a preset, get a correctly-sized empty latent for your model. The difference is a Custom preset that exposes the five numbers the plain node keeps locked inside its config - so when your model isn't in the list (a new Cosmos-Predict2 derivative, a custom VAE, a checkpoint trained at an odd resolution), you can stop hoping and set them yourself.
The five knobs
All of these only do anything when latent_alignment is set to Custom - the tooltips say so, and it's worth repeating because people twist sliders on preset mode and wonder why nothing changed:
- block_size - the pixel alignment constraint (8–64). SD-family presets ship at 64, FLUX.1 at 32.
- spacial_downscale_ratio - your VAE's total downsampling factor. 8 for SD/SDXL/FLUX.1/Anima, 16 for FLUX.2.
- target_mp - the megapixel target the optimizer aims for (0.05–32).
- search_range - how many block-steps to hunt around the ideal size. Higher values find better fits at extreme aspect ratios.
- channels - the latent channel count. 4 for SD1/SDXL, 16 for FLUX/Cosmos/Qwen-VAE models. Get this wrong and the result is noise or flat colour, not a subtly wrong image - a channel mismatch is catastrophic, not cosmetic.
The defaults mirror the base Custom config (block 64, 8x downscale, 1 MP, range 12, 4 channels), so you're starting from a sensible place and only changing what you must.
Everything else is inherited
The rest behaves exactly like the plain node: dimensions takes 16:9, 1920x1080, or 1.7778; optimization ON = auto-pick, OFF = exact WxH (and remember, with it ON 1280x720 is read as a ratio); invert flips orientation; batch_size scales VRAM. Outputs are identical - Latent into your KSampler, plus Width, Height, Block Size, and a Details string showing actual vs. target megapixels and the latent shape.
Which one should you reach for?
If your model is SD1.x, SDXL, SD3, FLUX.1, FLUX.2, or Anima, the plain OptiEmptyLatent is all you need - the presets are tuned per model and you'll never touch these numbers. Grab the Advanced one when you're on something newer or off-menu. It's also the better tool for experimentation: want to know if Anima behaves at 1.5 MP instead of its ~1 MP sweet spot? That's a two-slider change here.
Install is shared with its sibling - same pack, no separate setup:
cd ComfyUI/custom_nodes
git clone https://github.com/Taithrah/ComfyUI_Fens_Simple_Nodes
or ComfyUI Manager → search "Fens-Simple-Nodes", then restart. No model downloads, no extra dependencies. And like the rest of the pack it's built on ComfyUI's V3 node API - if the node won't load, update ComfyUI before you file the bug report.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| dimensions | STRING | 1:1 | Formats: W:H (e.g. 16:9), WxH (e.g. 1280x720), or decimal (e.g. 1.777). Use WxH when 'Optimization' is FALSE. |
| latent_alignment | COMBO | SDXL (1024px) | Optimization preset for model type. Select 'Custom' to set your own parameters. |
| optimization | BOOLEAN | true | TRUE: Automatically calculates best resolution for your aspect ratio. FALSE: Use your own resolution (WxH format). |
| invert | BOOLEAN | false | Swap width and height (invert aspect ratio, e.g. 16:9 > 9:16). |
| batch_size | INT | 11–4096 | Number of latent images in batch (VRAM usage increases with batch size). |
| block_size | INT | 648–64 | Pixel dimension alignment constraint. (Only used when 'Custom' is selected.) |
| spacial_downscale_ratio | INT | 88–64 | The VAE's total downsampling factor. (Only used when 'Custom' is selected.) |
| target_mp | FLOAT | 1.0000.05–32 | Target megapixels. (Only used when 'Custom' is selected.) |
| search_range | INT | 121–100 | Search range for optimization. Higher values search more possibilities. (Only used when 'Custom' is selected.) |
| channels | INT | 41–128 | Latent channel count (e.g. 4 for SD1/SDXL, 16 for FLUX/Cosmos-Predict2-family). (Only used when 'Custom' is selected.) |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| Latent | LATENT | Latent tensor |
| Width | INT | Width |
| Height | INT | Height |
| Block Size | INT | Block size used for the calculation. |
| Details | STRING | Details about the calculation |