Image scale by ratio
Multiply an image's size by a number
- image
- IMAGE
Sometimes you don't care about an exact target size - you just want "half this" or "twice this." That's what this node is for. Give it an image and a multiplier, and it scales both dimensions by that factor. 2.0 doubles it, 0.5 halves it, 1.5 gives you a 50% bump. The aspect ratio is preserved automatically because you're scaling both axes by the same number.
It's part of Derfuu_ComfyUI_ModdedNodes, an older utility pack whose whole reason to exist is automating this kind of size arithmetic inside the graph. If you want to pin an exact edge length instead of a ratio, its sibling Image scale to side is the one you want.
How it works
It's core ComfyUI-style resampling with a ratio input. The upscale_by number multiplies the current width and height; the node then resamples the pixels with the filter you pick. Nothing generative happens here - it's interpolation, the fast "more pixels" path. Scaling up won't invent detail that wasn't in the source.
The inputs that matter
image(IMAGE) - the input.upscale_by(FLOAT, default 1.0) - the multiplier. Below 1 shrinks, above 1 grows. This is the one knob that does the work.upscale_method- the resampling filter:nearest-exact,bilinear,bicubic,bislerp,area,lanczos. For shrinking,areaorlanczos. For growing,lanczos/bicubic.nearest-exactonly for pixel art.crop-disabledorcenter, default disabled.
One output: IMAGE.
Where it earns its keep
The classic pairing is with a model upscaler. ImageUpscaleWithModel always applies its model's fixed factor - usually 4x - which is often more than you want. Run the 4x, then drop this after it at 0.5 and you've got a clean 2x net result with the detail benefit of the ESRGAN pass and none of the "why is my image 8000px" surprise. It's also handy for feeding a downscaled copy of an image into a second sampler pass.
Because upscale_by is a float input, you can also drive it from a math node - compute a ratio elsewhere in the graph and wire it in - which is exactly the kind of automation this pack was built for.
Common issues & troubleshooting
Node missing / red after an update. Derfuu has a habit of deleting old node classes when reorganizing the pack instead of leaving them deprecated, so updates can break saved workflows. Update via Manager and re-add the node if it disappears.
ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'. An old graph pointing at a module path that moved during a reorg. Update the pack, reload, replace the stale node.
Blurry result when scaling up. That's interpolation doing its honest thing - there's no detail to recover. Use a real upscale model for sharpness and reserve this for sizing.
Odd final dimensions. A ratio on odd source sizes can produce non-even results, which some downstream nodes (VAE, samplers) dislike. If a later node complains, use Image scale to side to land on a clean, divisible number instead.
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, no extra pip dependencies.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| upscale_by | FLOAT | 1.00 | — |
| upscale_method | COMBO | 6 options: nearest-exact, bilinear, bicubic, bislerp, area, lanczos | |
| crop | COMBO | 2 options: disabled, center |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |