Nodes/Comfyui-EzFlex-Presets/EzFlex-FreeLatent
ComfyUI Node

EzFlex-FreeLatent

Stop Typing the Same Resolution Into Four Nodes

By blackbossokok·Created 20 days ago·Updated about 15 hours ago· 1
EzFlex-FreeLatent
    • Latent
    • Width
    • Height
    • Batch
    config{}
    width0
    height0
    batch_size0

    Every ComfyUI workflow has a size problem. EmptyLatentImage wants width, height and batch as three widgets. Then something downstream - an upscaler, a filename builder, a ControlNet preprocessor you resized to match - wants those same two numbers again, and you retype them. Get one of them wrong and nothing errors; you just get an image that is subtly stretched, or a save path that lies about what it contains.

    EzFlex-FreeLatent (the panel calls it "Resolution / Latent Selector") exists to make the size one thing. You pick it once, and it comes out as an empty latent plus the actual pixel numbers as separate integer outputs.

    How it works

    The node is a thin wrapper around a panel. Its only required input is config, a socketless JSON string the embedded canvas UI writes into the node whenever you change anything - width, height, batch, the align step, the current ratio, whether "force override" is on. You never type in it.

    At execution it parses that JSON, applies the align step, and builds the latent directly:

    latent = torch.zeros([batch, 4, h // 8, w // 8], dtype=torch.float32)
    

    That is the whole trick, and it is also the constraint: an image latent is pixels divided by 8, so both dimensions have to be divisible by 8. If your aligned numbers aren't, the node stops with a clear error instead of handing the sampler a malformed tensor. The panel also floors sizes at 64px, so typing 32 gets you 64.

    Inputs and outputs that matter

    Three optional integers - width, height, batch_size - all default 0 and all force_input, meaning they're real sockets, not widgets. A value greater than 0 overrides the panel for that field; 0 or nothing uses the panel value. That's how you drive resolution from a math node or a batch-size controller without fighting the canvas.

    The panel's force override switch inverts that: while it's green, the external inputs are ignored entirely and the panel wins. It only unlocks once at least one of them is connected, and it's the thing to check first when someone wires a width in and the node cheerfully ignores it.

    Outputs:

    • Latent - (batch, 4, height/8, width/8). Wire it to your sampler's latent_image.
    • Width, Height, Batch - plain INTs. These are the underrated part. Feed Width/Height into your filename string, into an image-resize node, into anything that needs to agree with the sampler. The KB's plumbing overview makes the point for value nodes generally: the reason to break a value out of a widget is so there's one authoritative source instead of five copies that drift.

    If you generate at SDXL-family sizes, stick to the trained buckets (1024x1024, 1152x896, 1216x832, 1344x768, 1536x640) - the ratio presets in the panel map neatly onto those, and going wildly off them is the standard cause of the "why does everyone look stretched" complaint.

    Install

    There are no models to download and nothing to configure before first use. Either search EzFlex in ComfyUI Manager and install "EzFlex Presets", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/blackbossokok/Comfyui-EzFlex-Presets
    pip install -r requirements.txt   # mutagen only; torch/numpy/Pillow/safetensors/av ship with ComfyUI
    

    Restart ComfyUI and look for the node under the EzFlex category. One version note: the pack's metadata requires ComfyUI 0.3.13 or newer, because it uses the official i18n endpoint. On an older build the panels can come up without their language strings.

    A word on provenance, since this isn't a pack with a decade of threads behind it: single-author MIT project, first published September 2026, currently around v1.2.5, and by its own README "built with AI assistance - still being improved". There's no community history to lean on yet, so the README and the source are the documentation. Read the tooltips.

    Common issues

    "the aligned size 1000x1000 (align=8) is not a multiple of 8" - you asked for 1000. Set align to a multiple of 8 (8, 16, 32, 64) or change the size. The error is the node refusing to guess on your behalf, which is the right call.

    External width/height do nothing. Force override is on. It's a per-node panel switch, not a global setting.

    Presets didn't follow the size you expected. Size presets save the current actual size, and custom ratios are saved per node instance, so a preset made on a 3:2 canvas won't read as 3:2 anywhere else.

    CategoryEzFlex

    Inputs (4)

    NameTypeDefaultDescription
    configSTRING{}Config JSON generated by the resolution panel (width / height / batch / algorithm / ratio).
    widthoptINT00–32768External width: >0 overrides the panel width (0 / empty = use the panel value).
    heightoptINT00–32768External height: >0 overrides the panel height (0 / empty = use the panel value).
    batch_sizeoptINT00–4096External batch: >0 overrides the panel batch (0 / empty = use the panel value).

    Outputs (4)

    NameTypeDescription
    LatentLATENTEmpty latent (batch, 4, height/8, width/8)
    WidthINTWidth in pixels
    HeightINTHeight in pixels
    BatchINTBatch size