🧊AGSoft Empty Latent Plus
One empty latent node for every model — 4 channels, 16, or 128, it picks for you
- latent
- width_px
- height_px
- display
Here's the trap: ComfyUI's built-in Empty Latent Image is hard-coded for SD1.5/SDXL's latent format - 4 channels, 8× compression. The moment you load a FLUX.1 or a QwenImage checkpoint and feed it that latent, you get noise or flat color, because those models use a 16-channel VAE. FLUX.2 went further and re-trained the whole latent space at 128 channels. So "empty latent" stopped being one node and became three, each tuned to a model family.
🧊AGSoft Empty Latent Plus collapses that back into one. You pick your model family, and it builds a correctly-shaped empty latent: right channel count, right compression factor, right resolution for that VAE. It's the node to reach for when you've sworn off maintaining four different "empty latent for X" nodes in every workflow.
How it works
Under the hood it's two things welded together. First, a model_type table maps your model family to its latent geometry - SD1.5/SDXL = 4ch × 8, SD3/FLUX.1/Krea2/QwenImage = 16ch × 8, FLUX.2/Flux2-klein = 128ch × 16. Second, a size engine (the same one AGSoft Aspect Ratio uses) figures out the pixel dimensions: pick a ratio and anchor it by width/height/longest/shortest/megapixels, grab a ready-made preset, or type W×H manually.
The nice detail is in the final alignment: after rounding to multiple (default 64), the node also guarantees the result is divisible by the latent factor. A 16:9 at base 1024 becomes a clean 1024×576 pixel canvas, which the VAE shrinks to a 128×72 latent at 16 channels. You never see the intermediate math; you get the real pixel dimensions out as numbers.
The inputs that matter
model_type- the one that actually matters. Set it to match your checkpoint's VAE. Pick wrong and the latent is the wrong shape, and no amount of sampling fixes it.size_mode-Ratio(ratio + anchor),Preset(81 ready resolutions like "Square - 1024x1024 (1:1)"), orCustom(manual W×H). Only the fields for the active mode are read; the rest sit ignored.batch_size- how many empty latents to stack for batch generation (1–64).
The rest (ratio_preset, custom_ratio, base, base_value, megapixels_value, multiple, rounding) are the ratio engine's knobs, identical to the standalone Aspect Ratio node. For a single image you mostly set model_type, size_mode = Preset, and pick a resolution.
Outputs and where they go
latent→ straight into a KSampler.width_px/height_px(INT) → the real pixel size, handy if a downstream node needs to know the canvas it's getting.display(STRING) → a "1024×576 (16:9) → latent 128×72 · ch 16" line for Show Text or a filename.
Installing it
It ships in the comfyui-AGSoft pack, so one install covers this and the ~100 other AGSoft nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft
restart, or search comfyui-AGSoft in ComfyUI Manager. The pack's declared deps are numpy, opencv-python, and translators - this node only actually needs torch, which ComfyUI already has.
Where people get burned
The classic mistake is model_type not matching the checkpoint - a 128-channel FLUX.2 latent decoded through an SDXL VAE produces static, and it can be hard to diagnose because the sampler runs fine. Keep the two in sync and you're golden. Also note the default multiple here is 64, not the 8 the standalone Aspect Ratio uses - that's deliberate (Flux-family VAEs want 64-aligned dimensions), so don't "helpfully" drop it to 8 for a FLUX workflow.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| model_type | COMBO | SD3 / FLUX.1 / Krea2 / QwenImage | Latent format: channels & compression factor. SD1.5/SDXL=4ch·8, SD3/FLUX.1/Krea2/Qwen=16ch·8, FLUX.2=128ch·16. --- Формат латента: каналы и фактор сжатия. SD1.5/SDXL=4ch·8, SD3/FLUX.1/Krea2/Qwen=16ch·8, FLUX.2=128ch·16. |
| size_mode | COMBO | Ratio | How the size is set: Ratio = proportion+anchor, Preset = ready sizes, Custom = manual W×H. --- Как задаётся размер: Ratio = пропорция+якорь, Preset = готовые размеры, Custom = вручную W×H. |
| size_preset | COMBO | Square - 1024x1024 (1:1) | Ready-made resolution (orientation, WxH, ratio). Used only when size_mode = Preset. --- Готовое разрешение (ориентация, WxH, пропорция). Работает только при size_mode = Preset. |
| ratio_preset | COMBO | 1:1 | Aspect ratio preset (W:H). Choose 'custom' to enter your own in custom_ratio. --- Пресет пропорции (W:H). Выберите 'custom', чтобы задать свою в custom_ratio. |
| custom_ratio | STRING | 16:9 | Your own aspect ratio (W:H), e.g. 16:9, 1.85:1, 2.39:1. Used only when ratio_preset = custom. --- Своя пропорция (W:H), напр. 16:9, 1.85:1, 2.39:1. Работает только при ratio_preset = custom. |
| base | COMBO | width | Which side/value is fixed: width / height / longest / shortest side or total megapixels. --- Что фиксировано: width / height / длинная / короткая сторона или суммарные мегапиксели. |
| base_value | FLOAT | 10241–16384 | Value (px) of the fixed side for width/height/longest/shortest anchors. --- Значение (px) фиксируемой стороны для якорей width/height/longest/shortest. |
| megapixels_value | FLOAT | 1.00.1–100 | Total image size in megapixels (step 0.1). Used only when base = megapixels. --- Общий размер в мегапикселях (шаг 0.1). Только при base = megapixels. |
| width | INT | 10248–8192 | Latent width in pixels. Used only when size_mode = Custom. --- Ширина в пикселях. Работает только при size_mode = Custom. |
| height | INT | 10248–8192 | Latent height in pixels. Used only when size_mode = Custom. --- Высота в пикселях. Работает только при size_mode = Custom. |
| multiple | INT | 641–128 | Align W/H to a multiple (8/32/64/112). 1 = no rounding. --- Выравнивание W/H под кратность (8/32/64/112). 1 = без округления. |
| rounding | COMBO | round | Rounding method when aligning to the multiple: floor / round / ceil. --- Метод округления при выравнивании: floor (вниз) / round (ближайшее) / ceil (вверх). |
| batch_size | INT | 11–64 | Number of empty latent images in the batch. --- Количество пустых латентных изображений в батче. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| width_px | INT | — |
| height_px | INT | — |
| display | STRING | — |