Nodes/Derfuu_ComfyUI_ModdedNodes/Image scale to side
ComfyUI Node Runs on cloud

Image scale to side

Scale an image to a target edge length

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Image scale to side
  • image
  • IMAGE
side_length1
side
upscale_method
crop

Resize an image so one chosen edge hits an exact pixel length, and let the other edge follow so nothing stretches. That's the whole job. You say "make the longest side 1024" and it does the aspect-ratio arithmetic for you. Simple, and genuinely handy when your workflow needs images at a predictable size.

The DF_ prefix is just how the current Derfuu_ComfyUI_ModdedNodes pack names its classes. If you've seen this same node listed as plain Image scale to side, that's the older name for the exact same thing - Derfuu renamed things when the pack was reorganized. This page is the current class.

How it works

It's a standard pixel resize wrapped in a convenience layer. Instead of making you compute both dimensions, you feed it one edge and a length, and it scales the image proportionally. A 1024x768 image with side = Longest, side_length = 1536 becomes 1536x1152.

Keep the mental model straight: this is a resampler, part of the "more pixels" family, not a detail-adding upscaler. Scaling above the source resolution interpolates - it won't sharpen anything that wasn't there. For real detail you want a model-based upscaler; this is for fitting sizes.

The inputs that matter

  • image (IMAGE) - the input.
  • side_length (INT) - target pixels for the chosen edge.
  • side - Longest, Shortest, Width, or Height. Longest/Shortest don't care about orientation, which is usually what you want; Width/Height pin a specific axis.
  • upscale_method - the filter: lanczos and bicubic are the safe defaults, area is great for downscaling, nearest-exact is pixel-art only.
  • crop - disabled or center; leave it disabled unless you want a hard center crop.

One output: IMAGE.

Where it fits

The two everyday uses: normalizing a batch of mixed-size images to a consistent edge before the rest of the graph runs, and pinning an exact final size after a fixed-factor model upscale. Since ImageUpscaleWithModel always applies its model's native 4x, dropping this after it lets you land on, say, exactly 2048px instead of whatever 4x produced. Upscale big, then scale to side.

Common issues & troubleshooting

Node went red after updating ComfyUI or the pack. Derfuu has a track record of removing old node classes on reorg instead of keeping them around deprecated, so saved graphs can break across updates. If this or a sibling node disappears, re-add the current version and re-wire it.

ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'. That's an old workflow pointing at a module path that shifted during a reorg. Update the pack, reload, replace the offending node with this current DF_ one.

Soft output on upscale. Expected - it's interpolation. Use a real upscale model when you need sharpness, and use this only to fix the dimensions.

Wrong aspect result. You selected Width or Height when Longest/Shortest was what you meant.

Install: ComfyUI Manager → search "Derfuu" → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes then restart. No model downloads, no heavy dependencies - it's plain Python.

CategoryDerfuu_Nodes/Modded nodes/Image

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
side_lengthINT1-9223372036854776000–9223372036854776000
sideCOMBO4 options: Longest, Shortest, Width, Height
upscale_methodCOMBO6 options: nearest-exact, bilinear, bicubic, bislerp, area, lanczos
cropCOMBO2 options: disabled, center

Outputs (1)

NameTypeDescription
IMAGEIMAGE