Smart Latent Generator
EmptyLatentImage, except the resolution math is already done
- LATENT
Smart Latent Generator is the sister node to the same pack's Smart Resolution Picker, and it collapses two steps into one. Instead of running the picker and feeding its width/height into an EmptyLatentImage, this node takes the same two dropdowns, does the same math, and hands you a ready-to-sample LATENT that plugs straight into a KSampler.
If that sounds familiar, it should - functionally, this is EmptyLatentImage with a resolution calculator bolted on. The honest take: if you already type exact sizes, you don't need it. If you're constantly fiddling with ratios for portrait crops or 9:16 video-ish outputs, the dropdowns save you the arithmetic and remove one node from the graph.
How it works
Under the hood it's refreshingly boring. It takes your preset's long side, scales it to your aspect ratio, snaps both edges to the nearest multiple of 64, then builds the latent tensor itself:
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
That // 8 is the part worth understanding. The VAE compresses images 8× per side into a 4-channel latent space - a 1024×1024 image lives in a 128×128×4 latent. That's why this node divides by 8 instead of doing anything clever, and why it produces a zeros tensor: the sampler adds the noise, this node just lays down the empty canvas. It works for any model on the standard SD 1.5 / SDXL / Flux VAE layout.
The presets are long sides, not fixed canvases - FullHD-1920px with 9:16-TikTokReel gives you a 1088×1920 latent, while the same preset with 16:9-Widescreen gives 1920×1088. Watch those 1088s: 1080 isn't a multiple of 64, so the snap nudges your "FullHD" a few pixels up. It's latent-safe, just not marketing-exact.
The inputs and outputs
Three inputs, and honestly only one of them is new:
resolution_preset-SD-512pxthrough8K-7680px(seven options, defaults toFullHD-1920px).aspect_ratio- nine options from1:1-AlbumArtto32:9-UltraWideBanner, default16:9-Widescreen.batch_size- an INT from 1 to 16, default 1. This is the one EmptyLatentImage had that the picker didn't, and it's what makes this node actually useful for multi-image generation without a repeat node.
Output is a single LATENT, wired into any KSampler's latent input. That's the whole graph: checkpoint → positive/negative conditioning → SmartLatentGenerator → KSampler.
Installing it
ComfyUI Manager - search "Smart Resolution Toolkit" - or:
cd ComfyUI/custom_nodes
git clone https://github.com/buddy-bytes/ComfyUI-SmartResolutionToolkit
Then restart ComfyUI. requirements.txt is empty and there are no model files, so nothing else to download.
Where people get burned
Same traps as any latent creator, plus a couple of specifics. Picking 4K-3840px or 8K-7680px on an SDXL or SD 1.5 model produces a giant empty latent that the sampler dutifully fills with gibberish - the model was trained at ~1MP, and it doesn't know what to do with a 4K canvas. Generate at native resolution and upscale after. And watch the batch_size: it caps at 16, but a 16-image batch at FullHD is a fast way to run out of VRAM, so start at 1 or 2.
A minor quirk, too: the README describes preset canvases ("2K Cinema 2048×1080") that don't literally exist as options - the presets are edge lengths, so your actual output depends on the ratio you pair them with. And this is a young, low-traffic pack (this node has zero impressions so far), so treat it as a convenience utility rather than community-verified software. It's ~20 lines of straightforward torch, which keeps the risk low.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| resolution_preset | COMBO | FullHD-1920x1080 | 7 options: SD-512px, HD-1280px, FullHD-1920px, 2K-2048px, QHD-2560px, 4K-3840px, +1 |
| aspect_ratio | COMBO | 16:9-Widescreen | 9 options: 1:1-AlbumArt, 4:5-InstagramPortrait, 2:3-ClassicPortrait, 3:4-EditorialPortrait, 9:16-TikTokReel, 4:3-ClassicVideo, +3 |
| batch_size | INT | 11–16 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |