⭐ Star Latent Resize
Resize a latent to a model-friendly size without remembering megapixel math
- LATENT
- LATENT
- WIDTH
- HEIGHT
Here's a failure mode you'll hit within your first week of img2img: you encode an image, wire the latent into a sampler, and get a cryptic shape mismatch - or worse, a silently wrong-looking result, because your latent's size isn't what the model's training expects. Star LatentResize fixes the boring half of that problem: it resizes a LATENT to a target resolution with one dropdown, and hands you back the exact new WIDTH and HEIGHT as numbers so nothing downstream has to guess.
How it works
Latents live at a fraction of pixel resolution (a 1024px image is a 128×128 latent after an 8x-downsampling VAE), but you don't need to think in that scale here. The node takes your latent and either preserves its aspect ratio or lets you specify a custom size, then interpolates to the chosen target. The ratio dropdown is the aspect decision: Keep Input Ratio (the default) scales to a target area while preserving your source's proportions, and Custom Size uses custom_width / custom_height directly. That distinction is the whole usability win - most resize nodes force you to pick a bare resolution and stretch your content to fit; this one can shrink-to-fit without squashing.
The resolution dropdown (21 options) is where the presets live, and they're model-aware rather than abstract pixels: SD (~512), SDXL (~1024), Qwen Image (~1328), WAN HD (1280×720), WAN FullHD (1920×1080), then 2–7 Megapixel targets. Pick the family you're sampling with and the node handles the divisibility. custom_width / custom_height default to 1920×1080 with a 16-pixel step, and the range goes up to 99968 - plenty for outpainting-adjacent workflows.
Inputs and outputs
LATENT- your encoded latent.ratio- keep aspect or go custom.resolution- the model-aware size preset, orcustomto use the width/height fields.custom_width/custom_height- used when ratio is Custom Size or resolution iscustom.LATENT(out) - the resized latent, same channel count, ready for a sampler.WIDTH/HEIGHT(out, INT) - the actual new latent dimensions. Wire these into an Empty Latent or a conditioning node that needs to know the shape, so you never hardcode a number.
Where it fits
Anywhere a latent crosses model boundaries: img2img where your source is 832×1216 and the model's happy zone is 1024², or a latent upscale where you resize before a high-res pass. The WIDTH/HEIGHT outputs are the sneaky good part - they let downstream nodes adapt automatically instead of you re-typing dimensions.
Installing
Part of the StarNodes pack - install Starnodes via ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
cd ComfyUI_StarNodes
pip install -r requirements.txt
Restart, then search star on the canvas. No models, pure torch interpolation.
Common issues
The trap is forgetting that resizing a latent is not free detail - enlarge too far and the sampler invents mush. Keep your target within the model family's native range (the presets exist for exactly that reason). And if a sampler still complains about shape after resizing, check you're not resizing to a size that breaks the model's divisibility rule; the 16-step on the custom fields is there to prevent it, so use the fields rather than free-typing odd numbers.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| LATENT | LATENT | — | |
| ratio | COMBO | Keep Input Ratio | 2 options: Keep Input Ratio, Custom Size |
| resolution | COMBO | 2 Megapixel (≈ 1408x1408) | 21 options: custom, SD (≈ 512x512), SDXL (≈ 1024x1024), Qwen Image (≈ 1328x1328), WAN HD (≈ 1280x720), 2 Megapixel (≈ 1408x1408), +15 |
| custom_width | INT | 192016–99968 | — |
| custom_height | INT | 108016–99968 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |
| WIDTH | INT | — |
| HEIGHT | INT | — |