Nodes/comfyui-superside-nodes/Superside Scale Image to Total Pixels
ComfyUI Node

Superside Scale Image to Total Pixels

Scale to a megapixel target, not a side — the working-resolution workhorse

By Superside·Created about a month ago·Updated 3 days ago· 1
Superside Scale Image to Total Pixels
  • image
  • IMAGE
upscale_method
megapixels1.00
resolution_steps1

"Scale to total pixels" is the resize you want when the number that matters is how many pixels, not how wide or how tall. This node hits a target megapixel count while keeping the aspect ratio, and it's the Superside in-house equivalent of core ComfyUI's ImageScaleToTotalPixels. The use case that makes it a daily driver: working resolution.

The pattern is everywhere in production ComfyUI: you don't generate at the final size, you generate at a smaller "working" resolution - cheap, fast, and fast enough for a diffusion model to do its thing - then upscale the result at the end. A target-megapixel resize is the clean way to express "I want this pass to run at about 1 megapixel no matter what aspect ratio came in." You never have to think about whether a portrait is 1024×1536 or a landscape is 1536×1024; you say "1 MP" and the math sorts itself out.

The inputs that matter

  • megapixels (default 1.0, 0.01–16) - the target. 1 MP is a solid default for a diffusion working pass; 2–4 MP for higher-res work; the low end is for deliberately tiny draft passes.
  • upscale_method - nearest-exact, bilinear, area, bicubic, or lanczos. For downscaling, area is the good choice (it averages, so it resists aliasing); for upscaling, lanczos or bicubic. Yes, the input is called "upscale_method" even though this node downscales too - that's inherited from core, don't let it confuse you.
  • resolution_steps (default 1) - rounds the output dimensions to a multiple of this value. Some diffusion-friendly sizes like multiples of 8 or 64 are worth setting here if you're feeding the result straight into a sampler. Default 1 means no rounding.

One output: the resized IMAGE.

How it works

Pure local math: it computes a scale factor from your target total pixel count relative to the input, derives width and height, rounds them to resolution_steps, and resamples with your chosen method. No model, no API key, no fal credits, and no network - this node never leaves the machine.

Installing it

Standard pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/Superside/comfyui-superside-nodes
pip install -r requirements.txt

Restart ComfyUI and it's under Superside. Or find the pack by title in ComfyUI Manager.

Where it slots into a real workflow

The Superside docs point at the exact pattern: generate or composite at a small working resolution, then resize back up to the true original size for the final composite (their Resize To Match node is the "resize back" half of that pair). So the typical chain is: original → Image Scale To Total Pixels at ~1 MP → generative pass → upscale to full size. The trick to remember is that downscaling to a working resolution loses nothing you'll miss if your final upscale is doing the detail work - and for a diffusion pass specifically, feeding a model a bigger canvas than it can meaningfully fill usually just wastes time.

CategorySuperside

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
upscale_methodCOMBO5 options: nearest-exact, bilinear, area, bicubic, lanczos
megapixelsFLOAT1.000.01–16
resolution_stepsINT11–256

Outputs (1)

NameTypeDescription
IMAGEIMAGE