Proportional Image Scaling
Proportional scaling that keeps dims on the 8-pixel grid — no more blurry resizes
- image
- scaled_image
- width
- height
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) andmax_resolution(default 2560), so a strayscale_multiplier: 10can'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
autodefault 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.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image(s) to scale | |
| scale_multiplier | FLOAT | 1.000.1–10 | Scale factor - 1.0 = original size, 2.0 = double size, 0.5 = half size |
| resampling_method | COMBO | auto | Resampling method. 'auto' selects NEAREST for upscaling, LANCZOS for downscaling. |
| resolution_step | INT | 81–64 | Resolution alignment step (dimensions will be rounded to multiples of this value) |
| enable_limits | BOOLEAN | true | Enable resolution limits to prevent extremely large or small images |
| min_resolution | INT | 25664–4096 | Minimum resolution for the longest side when limits are enabled |
| max_resolution | INT | 256064–8192 | Maximum resolution for the longest side when limits are enabled |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| scaled_image | IMAGE | Scaled image(s) with proper aspect ratio preservation |
| width | INT | Width of scaled image |
| height | INT | Height of scaled image |