Ratio Latent
Pick a ratio, get a latent sized to fit
- latent
Ratio Latent is the sibling of the pack's Pixel Latent, with the thinking moved one level up. Instead of typing "768 x 1344" you pick a Width and an aspect Ratio - "16 : 9", "3 : 2", that crowd - and it builds an empty latent at the size those two imply. Same "give the sampler a blank canvas" job as core EmptyLatentImage, just aimed at people who think in aspect ratios rather than pixel counts. If you always generate at your model's native aspect, this is the node you'd reach for; the convenience is real, even though the math underneath is two lines.
Here's how it computes. Take your Width, take the ratio, then height = Width * ratio_height // ratio_width. So Width 768 at 16:9 becomes 768 × 432. Then it does the standard empty-latent dance: torch.zeros([batch_size, 4, height // 8, width // 8]) - 4 channels, 8x downscale per side, because that's what the SD1.5/SDXL/Flux VAE family compresses to.
And there's a gotcha hiding in that integer division, so check your numbers before you trust it. // floors, which means some Width × Ratio combos don't land on a clean multiple of 8. The worst offenders: Width 1024 at 3:2 gives a 682px height (682.67 floored), and after /8 that's 680 real pixels - not an exact 3:2. Width 1280 at 3:2 gives 853, rounded down to 848 on decode. The sampler will still run - latents don't strictly need multiples of 8 - but you won't get an exact 3:2 out the other side, and workflows that assume round numbers will notice. Most presets land fine; it's the 3:2 and 9:16 rows at larger widths that drift.
Inputs that matter: Width (5 choices: 384, 512, 768, 1024, 1280 - default 512), Ratio (9 options, default 1 : 1), and batch_size (1–20). Note there's no separate Height input - height is always derived. Output is a single LATENT, wired into KSampler → VAE Decode like any other empty latent.
Honest take: this overlaps hard with Pixel Latent, which just offers explicit pixel pairs. Ratio Latent wins when you think "I want a wide cinematic thing at 1024" and don't want to compute 1024 × 432 in your head. It loses when you need a specific resolution that isn't a clean ratio product. Same trade as always with this pack: a convenience clone, nothing more.
Install is the same for every node in the pack: ComfyUI Manager, search "zsq_prompt", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/windfancy/zsq_prompt
then restart ComfyUI. The requirements.txt is heavy (transformers, opencv-python, onnx, ultralytics, timm), but that mostly pays for the pack's image and segment nodes - this one needs no models. The README is nearly empty, so don't expect docs. And if Manager ever claims zsq_prompt conflicts with another pack even when you don't have it installed, that's a known false alarm - ignore it unless your workflow actually uses these nodes.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Width | COMBO | 512 | 5 options: 384, 512, 768, 1024, 1280 |
| Ratio | COMBO | 1 : 1 | 9 options: 1 : 1, 2 : 1, 3 : 2, 4 : 3, 16 : 9, 1 : 2, +3 |
| batch_size | INT | 11–20 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |