LatentUpscaleWithVAE
Upscale a latent through a real VAE roundtrip
- latent
- vae
- latent
There are two ways to make a latent bigger. The cheap way is to stretch the latent tensor directly with interpolation. The cleaner way is what LatentUpscaleWithVAE does: decode the latent to a real image with your VAE, resize that to the target dimensions, and re-encode it back to a latent. Because the resize happens in pixel space, you get a more faithful enlargement than smearing the compressed latent around, and it lands at exactly the width and height you ask for.
This is a nice middle option in a hires pipeline. Pure latent interpolation is fast but mushy; a full ControlNet-tile re-generation is high quality but heavy. A VAE roundtrip sits between them - it costs a decode and an encode, but it keeps the image honest before you hand it to a second sampling pass to add detail. RES4LYF's latent nodes are all about giving you precise control over these intermediate stages, and this is the "upscale properly" one.
How it works
Latent goes in, gets decoded to pixels through the VAE you provide, the image is resized to your target width×height, then re-encoded back to a latent. What comes out is a latent at the new resolution that actually corresponds to a resized image, not a stretched code.
The inputs and outputs that matter
latent(LATENT) - the latent to upscale.width/height(default 1024) - the exact target dimensions in pixels. This is absolute sizing, not a multiplier, so you get precisely the canvas you type.vae(VAE) - the VAE used for the decode/encode roundtrip. Use the same VAE your model expects, or the roundtrip introduces its own drift.
Output is a single latent at the new size - send it into your second-pass sampler at a partial denoise to sharpen up the detail.
How to install it
Ships with RES4LYF. ComfyUI Manager: search RES4LYF, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt
Portable builds use the embedded pip. Restart, hard-refresh (F5).
Common issues
Mismatched VAE is the sneaky one - feed it a VAE that isn't the one your model was trained with and the roundtrip subtly shifts color and detail every pass, which compounds if you upscale in stages. Keep the VAE consistent with the model. Second, this costs more than a plain latent stretch (you're running the VAE twice), so on very large targets or long batches it adds up; that's the price of the cleaner result. Third, like any latent upscale, the enlargement alone isn't the finish line - run a sampler afterward at something like 0.3–0.5 denoise to regenerate real high-frequency detail, otherwise you've just resized a soft image. And for very large jumps, two moderate passes beat one giant one to avoid the duplicated-feature failures that plague high-res generation.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — | |
| width | INT | 10248–1048576 | — |
| height | INT | 10248–1048576 | — |
| vae | VAE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |