๐ฆ RS Image MultiLatent
An empty latent that actually matches your VAE โ no more size-multiple errors
- vae
- latent
- width_px
- height_px
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/heightfrom 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, orMegapixels.active_preset-Standard,Qwen, orKrea2, which decides whichpreset_*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
Qwenpreset family instead - that's exactly why it's there. - Batch output.
batch_sizerepeats 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.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | VAE | โ | |
| size_mode | COMBO | 3 options: Preset, Custom, Megapixels | |
| active_preset | COMBO | Standard | 3 options: Standard, Qwen, Krea2 |
| preset_standard | COMBO | Square - 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_qwen | COMBO | Square - 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_krea2 | COMBO | Square - 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 |
| width | INT | 10248โ4096 | โ |
| height | INT | 10248โ4096 | โ |
| megapixels | FLOAT | 1.00.1โ10 | โ |
| aspect_ratio | COMBO | 11 options: 1:1, 3:2, 2:3, 4:3, 3:4, 16:9, +5 | |
| batch_size | INT | 11โ64 | โ |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | โ |
| width_px | INT | โ |
| height_px | INT | โ |