Image Latent Creator 🎨
A fresh empty latent, sized the SDXL way — before you've generated anything
- latent
- resolution
- width
- height
- batch_size
Every text-to-image workflow starts the same way: you need an empty latent in the right shape before the KSampler will do anything. ComfyUI's built-in Empty Latent Image does that, but it leaves you eyeballing width and height. Image Latent Creator instead hands you a dropdown of SDXL's optimal aspect ratios - the nine buckets like 3:2 at 1216×832 that the model was trained to like - so your canvas starts in the sweet spot, not somewhere a model tolerates.
It's part of the Painting Coder Utils pack, and it builds directly on the pack's Image Size Creator 📏: everything that node does, this does, plus it actually creates the latent and takes a batch size.
How it works
Pick mode (Landscape / Portrait / Square), pick a resolution from the SDXL preset list, and the node computes width and height (with an optional scale_factor multiplier). It then allocates a zero-filled latent tensor of the right shape: for an 1024×1024 canvas, that's [batch_size, 4, 128, 128] - the image is downsampled 8× per side because the VAE compresses pixels into the latent space the diffusion model actually works in. That tensor goes out as a LATENT dictionary ready for the KSampler.
The front-end JavaScript filters the resolution dropdown by mode, so in Landscape you only see the landscape ratios and vice versa - a small touch that keeps you from picking 5:12 while trying to build a wide canvas.
The inputs and outputs that matter
mode- Landscape, Portrait, or Square.resolution- the SDXL preset: 1:1 (1024×1024), 9:7 (1152×896), 7:9, 3:2, 2:3, 7:4, 4:7, 12:5 (1536×640), 5:12.scale_factor- multiplies the base resolution, from 0.1 to 10. Leave at 1 unless you know why you're scaling.batch_size- 1 to 64. Set this if you're generating a batch in one go.- Outputs:
latent(the empty LATENT for your KSampler), plusresolution,width,height, andbatch_sizeas separate outputs you can wire into nodes that need the numbers (like conditioning or metadata).
Where you'll reach for it
As the cleanest start of an SDXL text-to-image or img2img graph, and anywhere you want the canvas to be one of the ratios the model actually trained on rather than a random size you typed in. The batch-size output also makes it handy for batch workflows where a downstream node needs to know how many images it's handling.
One caution: this creates a zero latent, which is exactly what a fresh generation wants. Don't wire it into something expecting an already-sampled latent - that's a blank canvas, not a result.
Install
ComfyUI Manager → search Painting Coder Utils, or:
cd ComfyUI/custom_nodes
git clone https://github.com/jammyfu/ComfyUI_PaintingCoderUtils.git
Restart ComfyUI. No model downloads; the pack's dependencies (numpy, Pillow, torch, gradio) are already part of any working ComfyUI. If you're resurrecting an old workflow and get missing-node errors, the v0.3.0 namespace change is the culprit - use the included fixer at docs/fix/workflow_fixer.html.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 3 options: Landscape, Portrait, Square | |
| resolution | COMBO | 9 options: 1:1 (1024x1024), 9:7 (1152x896), 7:9 (896x1152), 3:2 (1216x832), 2:3 (832x1216), 7:4 (1344x768), +3 | |
| scale_factor | FLOAT | 1.00.1–10 | — |
| batch_size | INT | 11–64 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| resolution | * | — |
| width | INT | — |
| height | INT | — |
| batch_size | INT | — |