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

Latent Scale to side

DF_Latent_Scale_to_side – ComfyUI Node from Derfuu_ComfyUI_ModdedNodes

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

DF_Latent_Scale_to_side solves a slightly different problem than its sibling DF_Latent_Scale_by_ratio. Instead of "make this X times bigger," it's "make sure this specific side hits an exact length, whatever the input was." Pick "Longest" and a value of 1024, and no matter what size latent comes in - square, wide, tall - the longer of its two dimensions gets scaled to exactly 1024, with the other side following proportionally to keep the aspect ratio intact.

That's a genuinely different, and often more useful, way to think about resizing than a flat multiplier: you rarely care that something got "1.7x bigger," you care that it now fits within a specific budget (a max resolution, a target long edge for a hires pass). This node, like the rest of Derfuu_ComfyUI_ModdedNodes' "modded" scaling nodes, operates on the LATENT directly rather than a decoded image - which means it's meant to sit inside the diffusion pipeline, between sampling passes, without paying for a decode/re-encode round trip.

Inputs and output

Five required inputs:

  • latent - the LATENT to resize
  • side_length - the target INT length for the chosen side
  • side - which dimension gets locked to side_length: Longest, Shortest, Width, or Height
  • scale_method - nearest-exact, bilinear, bicubic, bislerp, area, or lanczos
  • crop - disabled or center

One output: LATENT.

Longest and Shortest are the two you'd use to control aspect-ratio-preserving resizes - "cap the long edge at 1536 no matter what shape came in" is the classic case for Longest. Width or Height pin one specific dimension to side_length regardless of which one happens to be bigger, which is what you want if you need an exact width (or height) and are fine letting the other dimension follow proportionally rather than caring which one is technically longer.

As with the ratio-based sibling node, bislerp is worth defaulting to for scale_method here - it's ComfyUI's own resize method, tuned for latent tensors specifically, where pixel-oriented methods like lanczos or bicubic are less of a natural fit.

Where it fits

This is the node for "get this latent to a specific size" mid-pipeline - between a base generation pass and a hires refinement pass, for instance, where you want a consistent long-edge target regardless of what aspect ratio the user's initial prompt or input image happened to produce.

Installing

The whole pack installs together - no single-node install. Through ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart ComfyUI. Manually:

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

then restart. No models, no unusual dependencies.

Troubleshooting

If it doesn't show up in the node menu right after installing, restart the server and hard-refresh your browser tab - that resolves the large majority of "installed but not visible" cases and isn't specific to this pack.

Double-check side matches what you actually intend - it's easy to pick Width when you meant Longest (or vice versa) and end up with a result that's the right size on one axis but not proportioned the way you expected on the other.

Worth knowing about the pack generally: its maintainer has, in the past, removed deprecated nodes outright on updates rather than keeping a legacy-labeled copy around, which has broken workflows for people who relied on the pack over the long term. This node has been a stable fixture and isn't among the ones historically pruned, but if an old workflow throws a missing-node error elsewhere after an update, that maintenance history is worth checking first.

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