Nodes/ComfyUI_RaykoStudio/๐ŸฆŠ RS Image MultiLatent
ComfyUI Node

๐ŸฆŠ RS Image MultiLatent

An empty latent that actually matches your VAE โ€” no more size-multiple errors

By RaykosanยทCreated about a year agoยทUpdated 4 days agoยท 79
๐ŸฆŠ RS Image MultiLatent
  • vae
  • latent
  • width_px
  • height_px
โ—„size_modeโ–พโ–บ
โ—„active_presetStandardโ–บ
โ—„preset_standardSquare - 1024x1024 (1:1)โ–บ
โ—„preset_qwenSquare - 1008x1008 (1:1)โ–บ
โ—„preset_krea2Square - 1024x1024 (1:1)โ–บ
โ—„width1024โ–บ
โ—„height1024โ–บ
โ—„megapixels1.0โ–บ
โ—„aspect_ratioโ–พโ–บ
โ—„batch_size1โ–บ

ComfyUI's stock Empty Latent Image works fine until it doesn't - its 8x downscale assumption is baked in, and the moment your VAE divides by 16, 32, or a Qwen's 28, you're fighting "size not divisible" errors or silently off-res latents. ๐ŸฆŠ RS Image MultiLatent (RS_Image_MultiLatent) is the replacement that reads the VAE's actual latent_channels and scale_factor and sizes the latent correctly, full stop. Wire in any VAE and it adapts, no configuration.

How it works

When you run it, the node inspects your connected VAE - via first_stage_config or the VAE's own latent_channels attribute - and picks up the true downscale factor (4, 8, 16, whatever it is). It also matches the VAE's device and dtype, which avoids those annoying half-cpu/half-cuda tensor errors when your VAE ended up on a different device than the sampler. Then it builds the latent in one of three ways:

  • Preset - pick from a library of 100+ resolutions. There are three preset families (Standard, Qwen, Krea2) because those models like different grids; Qwen presets start at 1008px rather than 1024, which is the whole story of why stock latents misbehave on it.
  • Custom - manual width/height from 8 to 4096.
  • Megapixels - set a target like 1.5 MP plus an aspect_ratio, and it computes the resolution for you. This is the VRAM-control mode.

Inputs that matter

  • vae - plug in any VAE. The whole point is that it doesn't assume 8x.
  • size_mode - Preset, Custom, or Megapixels.
  • active_preset - Standard, Qwen, or Krea2, which decides which preset_* dropdown is live.
  • batch_size - 1 to 64, how many identical latents to stack.

Outputs: latent (the LATENT tensor for your sampler), plus width_px and height_px integers you can wire into a text overlay or a resize node if you want the rest of the workflow to know the dimensions.

How to install

Part of ComfyUI_RaykoStudio:

cd ComfyUI/custom_nodes
git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git

Restart ComfyUI, or install via ComfyUI Manager by searching "ComfyUI_RaykoStudio". No extra Python packages beyond what the pack already pulls in (torch, numpy, Pillow, and friends).

Common issues

  • Latent shape surprises. If you hand a 1024x1024 preset to a model that wants a 28-multiple grid (Qwen), pick the Qwen preset family instead - that's exactly why it's there.
  • Batch output. batch_size repeats the same latent, which is right for "generate N from one seed slot" workflows but not for video-style frame batches.

The honest sizing-up: for plain SD 1.5 and SDXL, the stock Empty Latent node is fine and this is a luxury. It earns its keep the moment you're on Flux, Krea2, or any Qwen-Image architecture, where the default 8x math is quietly wrong. If you're only ever on one architecture, you can probably skip it.

Category๐ŸฆŠ RaykoStudio

Inputs (11)

NameTypeDefaultDescription
vaeVAEโ€”
size_modeCOMBO3 options: Preset, Custom, Megapixels
active_presetCOMBOStandard3 options: Standard, Qwen, Krea2
preset_standardCOMBOSquare - 1024x1024 (1:1)54 options: Square - 512x512 (1:1), Square - 640x640 (1:1), Square - 768x768 (1:1), Square - 1024x1024 (1:1), Square - 1280x1280 (1:1), Square - 1536x1536 (1:1), +48
preset_qwenCOMBOSquare - 1008x1008 (1:1)50 options: Square - 1008x1008 (1:1), Square - 1120x1120 (1:1), Square - 1344x1344 (1:1), Square - 1568x1568 (1:1), Square - 1792x1792 (1:1), Square - 2016x2016 (1:1), +44
preset_krea2COMBOSquare - 1024x1024 (1:1)54 options: Square - 512x512 (1:1), Square - 640x640 (1:1), Square - 768x768 (1:1), Square - 1024x1024 (1:1), Square - 1280x1280 (1:1), Square - 1536x1536 (1:1), +48
widthINT10248โ€“4096โ€”
heightINT10248โ€“4096โ€”
megapixelsFLOAT1.00.1โ€“10โ€”
aspect_ratioCOMBO11 options: 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, +5
batch_sizeINT11โ€“64โ€”

Outputs (3)

NameTypeDescription
latentLATENTโ€”
width_pxINTโ€”
height_pxINTโ€”