Nodes/ComfyUI Easy Use/ImageScaleToNormPixels
ComfyUI Node Runs on cloud

ImageScaleToNormPixels

Scale an image and keep it SD-legal

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
ImageScaleToNormPixels
  • image
  • image
upscale_method
scale_by1.00

Diffusion models are picky about dimensions. Feed a latent that isn't divisible by 8 and you get an error or a subtly mangled image, because the VAE downsamples by a factor of 8 and the math has to land on whole numbers. easy imageScaleToNormPixels is the node that lets you scale an image by any factor you like and quietly snaps the result to dimensions the sampler will actually accept. The "NormPixels" in the name is the whole point: normalize the pixel dimensions so nothing downstream chokes.

It's a small image utility from yolain's ComfyUI-Easy-Use pack, and it earns its keep in exactly the moment you'd otherwise be doing modulo arithmetic in your head to figure out why "must be divisible by 8" keeps popping up.

How it works

You give it a scale_by factor and it multiplies both dimensions by that number, then rounds to a model-friendly size. So a 750×500 image at scale_by 2.0 doesn't become an awkward 1500×1000-but-off number - it lands on clean, divisible dimensions you can encode straight into a latent.

The upscale_method input controls how the resampling actually happens, and it's the same set of algorithms ComfyUI uses everywhere:

  • lanczos - sharpest, best for upscaling detail. This is usually what you want going up.
  • bicubic / bilinear - smooth, safe general-purpose choices.
  • area - good for downscaling (scale_by under 1).
  • nearest-exact - hard pixel edges, for pixel art or when you specifically don't want smoothing.

Inputs and outputs

The two you'll set:

  • scale_by - the multiplier, from 0.01 up to 8. Above 1 enlarges, below 1 shrinks.
  • upscale_method - pick by intent: lanczos going up, area going down, bilinear if you don't care.

Output is a single image at the normalized size, ready for a VAE encode, another node, or a save.

Where it fits

Two spots. Pre-generation: you've got a source image of arbitrary size and you need to get it onto a latent grid without a dimension error. And mid-upscale: as a cheap resize step inside an upscaling chain, before a detail pass. It's not a fancy model-based upscaler - there's no ESRGAN here, no diffusion - it's a plain resampler with the divisibility problem solved for you. For real detail-adding upscales you'd still hand off to a proper upscale model afterward; this just gets the pixels to a sane size first.

Installing it

Comes with the pack. ComfyUI Manager → search "ComfyUI Easy Use" → install → restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/yolain/ComfyUI-Easy-Use, run install.bat (or pip install -r requirements.txt), restart. Theme swaps on first launch? Settings → Color Palette.

Common issues

Don't expect miracles from the upscale - this is interpolation, not generation. Scaling a small blurry image up by 8× gives you a big blurry image. lanczos is as crisp as pure resampling gets; for actual new detail you need a model-based upscaler or a low-denoise diffusion pass on top.

The other thing to keep straight: because the node normalizes dimensions, your output size may not be exactly original × scale_by. It'll be the nearest legal size. That's a feature, not a bug - it's the reason you're not staring at a divisibility error - but if you need a pixel-precise target, do the math and set an explicit resize instead.

CategoryEasyUse/Image

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
upscale_methodCOMBO5 options: nearest-exact, bilinear, area, bicubic, lanczos
scale_byFLOAT1.000.01–8

Outputs (1)

NameTypeDescription
imageIMAGE