Nodes/Pirog's Nodes for ComfyUI/Proportional Image Scaling
ComfyUI Node

Proportional Image Scaling

Proportional scaling that keeps dims on the 8-pixel grid — no more blurry resizes

By Pirog17000·Created about a year ago·Updated 10 months ago· 3
Proportional Image Scaling
  • image
  • scaled_image
  • width
  • height
scale_multiplier1.00
resampling_methodauto
resolution_step8
enable_limitstrue
min_resolution256
max_resolution2560

Resizing an image in ComfyUI is easy. Resizing it well - preserving aspect ratio, landing on the multiples-of-8 dimensions that diffusion models and VAE latents want, and not blowing past your VRAM ceiling - is a small pile of annoying math. Proportional Image Scaling wraps all of that in one node: a scale_multiplier in, a properly-sized image out, plus the width and height as integers so the rest of your graph can react to what it produced.

How it works

It scales both dimensions by scale_multiplier (0.1–10), keeps the aspect ratio, then rounds each side down to a multiple of resolution_step (default 8 - the number diffusion latents actually care about). Two safety rails keep you sane:

  • enable_limits (default on) - clamps the longest side between min_resolution (default 256) and max_resolution (default 2560), so a stray scale_multiplier: 10 can't blow your VRAM into orbit. Scale back up inside the limit and the multiplier effectively gets capped.
  • resampling_method - LANCZOS, NEAREST, BILINEAR, BICUBIC, or auto. The auto default picks NEAREST when upscaling (sharp, fast) and LANCZOS when downscaling (clean).

Outputs: scaled_image plus width and height INTs - wire those into anything that needs to know the new resolution (mask generation, crop nodes, a display).

Where you'd use it

  • Prepping an image for a sampler that wants specific dimensions.
  • Feeding the pack's tiled sampler a size that divides cleanly.
  • Any time you need to know what size the resize produced - most resize nodes make you re-measure the image afterward; this hands you the numbers.
  • As a quick guard before an upscaler so you don't feed it a 9000px monster.

Installing it

Part of Pirog's Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Pirog17000/Pirogs-Nodes
pip install -r Pirogs-Nodes/requirements.txt

Or search "Pirog's Nodes" in ComfyUI Manager and restart. Uses Pillow, which ComfyUI already ships.

Gotchas

The one that'll bite you is auto upscaling with NEAREST - it's fast and blocky, and for quality upscales most people would rather have LANCZOS even when enlarging. If "auto" output looks crunchy when you scale up, switch the method explicitly. Also note the resolution step is a floor, not a round: a 1020px result stays 1020 if the step is 8 (1024 is the next multiple up), so "multiples of 8" doesn't mean "nearest nice number." That's fine for latents, just don't expect aesthetic dimensions from it.

Categorypirog/transform

Inputs (7)

NameTypeDefaultDescription
imageIMAGEInput image(s) to scale
scale_multiplierFLOAT1.000.1–10Scale factor - 1.0 = original size, 2.0 = double size, 0.5 = half size
resampling_methodCOMBOautoResampling method. 'auto' selects NEAREST for upscaling, LANCZOS for downscaling.
resolution_stepINT81–64Resolution alignment step (dimensions will be rounded to multiples of this value)
enable_limitsBOOLEANtrueEnable resolution limits to prevent extremely large or small images
min_resolutionINT25664–4096Minimum resolution for the longest side when limits are enabled
max_resolutionINT256064–8192Maximum resolution for the longest side when limits are enabled

Outputs (3)

NameTypeDescription
scaled_imageIMAGEScaled image(s) with proper aspect ratio preservation
widthINTWidth of scaled image
heightINTHeight of scaled image