Nodes/Derfuu_ComfyUI_ModdedNodes/Latent Scale by ratio
ComfyUI Node Runs on cloud

Latent Scale by ratio

Upscale a latent by a factor, not a fixed size

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Latent Scale by ratio
  • latent
  • LATENT
modifier1.00
scale_method
crop

The native ComfyUI latent upscaler makes you type an exact target size. That's fine until you want a graph that works at any base resolution - a hires-fix pass that's always 1.5× whatever you generated, regardless of whether that was 768 or 1024. Latent Scale by ratio does exactly that: it multiplies a latent's dimensions by a ratio you set, so one number scales the image proportionally and your workflow stops caring about the specific starting size.

How it works

It reads the latent's current width and height, multiplies both by your modifier, and resamples to the new size using the interpolation method you pick - the same family of methods ComfyUI's built-in latent upscale offers. This is the intermediate step in a two-pass hires workflow: generate at base resolution, scale the latent up here, then run a second sampling pass at low denoise to add detail. Latent upscaling is the standard cheap way to do the second pass without decoding to pixels and back.

The inputs and outputs that matter

  • latent (LATENT) - the latent to resize, straight from your first-pass sampler.
  • modifier (FLOAT, min 0, default 1) - the scale factor. 1.5 and 2.0 are the usual hires values; 1 does nothing.
  • scale_method (enum: nearest-exact, bilinear, bicubic, bislerp, area, lanczos) - the interpolation. bislerp is ComfyUI's default for latents and a safe pick; nearest-exact is the crudest.
  • crop (enum: disabled, center) - leave disabled for a straight scale; center crops to fit.
  • Output: LATENT - the resized latent, into a second KSampler (or a VAE decode).

Where it fits

Two-pass hires is essential above a model's native resolution - generate too big in one pass and you get tiling, repeated anatomy, duplicated subjects. The fix is generate at native, then upscale and refine. Doing that upscale by ratio rather than to a fixed size is what makes a hires graph reusable: pair the same modifier with Derfuu's Conditioning area scale by ratio and any regional conditioning follows the image up in lockstep.

How to install it

ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes

then restart. No dependencies, no models - plain Python. The scaling reuses ComfyUI's own latent interpolation.

Common issues & troubleshooting

The second pass looks mushy or unchanged. Latent upscaling needs a refining pass to add detail - after scaling, run a KSampler at moderate denoise (roughly 0.4-0.6). Too low and you keep the soft upscale; too high and the image changes.

Repeated/tiled content after scaling too far. Big ratio jumps in one hop invite duplication. Two smaller steps (e.g. two 1.5× passes) often beat one 2.25×, and a model-based pixel upscaler can outperform latent upscale for large factors.

Dimensions come out invalid. A ratio can produce a non-multiple-of-8 size. If the sampler complains, adjust the modifier or round the target.

Node red after a pack update. Derfuu has deleted deprecated nodes on updates rather than keeping them labeled, so old graphs can reference vanished names - reconnect a current copy. A ModuleNotFoundError about Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep one named Derfuu_ComfyUI_ModdedNodes.

CategoryDerfuu_Nodes/Modded nodes/Latent

Inputs (4)

NameTypeDefaultDescription
latentLATENT
modifierFLOAT1.00
scale_methodCOMBO6 options: nearest-exact, bilinear, bicubic, bislerp, area, lanczos
cropCOMBO2 options: disabled, center

Outputs (1)

NameTypeDescription
LATENTLATENT