Nodes/Fens-Simple-Nodes/Optimal Empty Latent (Advanced)
ComfyUI Node

Optimal Empty Latent (Advanced)

The same great size-picker, now with a Custom knob for models the presets forgot

By Taithrah·Created 2 years ago·Updated 2 months ago· 6
Optimal Empty Latent (Advanced)
    • Latent
    • Width
    • Height
    • Block Size
    • Details
    dimensions1:1
    latent_alignmentSDXL (1024px)
    optimizationtrue
    invertfalse
    batch_size1
    block_size64
    spacial_downscale_ratio8
    target_mp1.000
    search_range12
    channels4

    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.

    CategoryFens_Simple_Nodes/Latent

    Inputs (10)

    NameTypeDefaultDescription
    dimensionsSTRING1:1Formats: W:H (e.g. 16:9), WxH (e.g. 1280x720), or decimal (e.g. 1.777). Use WxH when 'Optimization' is FALSE.
    latent_alignmentCOMBOSDXL (1024px)Optimization preset for model type. Select 'Custom' to set your own parameters.
    optimizationBOOLEANtrueTRUE: Automatically calculates best resolution for your aspect ratio. FALSE: Use your own resolution (WxH format).
    invertBOOLEANfalseSwap width and height (invert aspect ratio, e.g. 16:9 > 9:16).
    batch_sizeINT11–4096Number of latent images in batch (VRAM usage increases with batch size).
    block_sizeINT648–64Pixel dimension alignment constraint. (Only used when 'Custom' is selected.)
    spacial_downscale_ratioINT88–64The VAE's total downsampling factor. (Only used when 'Custom' is selected.)
    target_mpFLOAT1.0000.05–32Target megapixels. (Only used when 'Custom' is selected.)
    search_rangeINT121–100Search range for optimization. Higher values search more possibilities. (Only used when 'Custom' is selected.)
    channelsINT41–128Latent channel count (e.g. 4 for SD1/SDXL, 16 for FLUX/Cosmos-Predict2-family). (Only used when 'Custom' is selected.)

    Outputs (5)

    NameTypeDescription
    LatentLATENTLatent tensor
    WidthINTWidth
    HeightINTHeight
    Block SizeINTBlock size used for the calculation.
    DetailsSTRINGDetails about the calculation