Nodes/Derfuu_ComfyUI_ModdedNodes/Latent Scale to side
ComfyUI Node Runs on cloud

Latent Scale to side

Resize a latent by one edge in latent space

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Latent Scale to side
  • latent
  • LATENT
side_length512
side
scale_method
crop

Same idea as Image scale to side, but it operates on a latent instead of a pixel image. You pick which edge to pin, give it a target length, and it resizes the latent tensor so that side matches while keeping the aspect ratio. It lives in Derfuu_ComfyUI_ModdedNodes and it's the go-to when you want to do a hi-res-fix-style upscale without leaving latent space.

Why resize a latent at all

The point of scaling in latent space is that you skip the VAE round-trip. In a two-pass / hi-res-fix workflow you generate at native resolution, scale the latent up, then run a second low-denoise sampler pass so the model adds coherent detail at the new size - that second pass is what makes latent upscaling worth doing over a plain pixel resize. Our upscaling notes are blunt about this: hi-res fix is essential for anything above a model's native resolution, or you get tiling and repetition artifacts.

One gotcha specific to latents, and the pack's own README calls it out: latent dimensions are 8x smaller than the pixel image they decode to. A 512x512 image is a 64x64 latent. This node handles that for you - but it's why there's an original toggle on the get-size nodes and why the numbers you type here matter.

The inputs that matter

  • latent (LATENT) - the input, typically from an Empty Latent or a VAE Encode.
  • side_length (INT, default 512) - target length for the chosen side. Think in pixel terms; the node maps it to latent space.
  • side - Longest, Shortest, Width, or Height. Longest/Shortest ignore orientation.
  • scale_method - nearest-exact, bilinear, bicubic, bislerp, area, lanczos. bislerp and bicubic are the usual picks for latents.
  • crop - disabled or center, default disabled.

Output is a single LATENT - wire it into your second KSampler.

Where it fits

Drop it between your first sampler and a second one: sample → Latent Scale to side → sample again at lower denoise. Keep denoising on that second pass in the 0.3–0.5 range; above ~0.5 the composition starts to drift, which is the classic hi-res-fix mistake. This is a lighter-weight alternative to a full model-upscale detour when you just want more resolution with the model's own coherence.

Common issues & troubleshooting

Latent upscaling looks mushy or washed out. A latent resize alone doesn't add detail - the second sampler pass is what does. If you scaled and stopped, that's why. Add the low-denoise pass.

Composition changed after the second pass. Denoise is too high. Drop it toward 0.3–0.4.

Node red / missing after an update. Derfuu tends to delete old node classes on reorg rather than deprecate them, so updates can break saved graphs. Update the pack and re-add the node.

ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'. Old workflow, moved module path. Update, reload, replace the stale node.

Install: ComfyUI Manager → search "Derfuu" → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes then restart. No models or heavy dependencies - pure Python.

CategoryDerfuu_Nodes/Modded nodes/Latent

Inputs (5)

NameTypeDefaultDescription
latentLATENT
side_lengthINT512-9223372036854776000–9223372036854776000
sideCOMBO4 options: Longest, Shortest, Width, Height
scale_methodCOMBO6 options: nearest-exact, bilinear, bicubic, bislerp, area, lanczos
cropCOMBO2 options: disabled, center

Outputs (1)

NameTypeDescription
LATENTLATENT