Nodes/ComfyUI-KikoTools/Resolution Calculator
ComfyUI Node

Resolution Calculator

Stop Doing Upscale Math in Your Head

By ComfyAssetsΒ·Created about a year agoΒ·Updated 2 months agoΒ· 19
Resolution Calculator
  • image
  • latent
  • width
  • height
β—„scale_factor2.0β–Ί

Resolution Calculator answers the most boring question in upscaling - "wait, what size do I tell the upscaler to output?" - so you don't have to. Feed it an image or a latent, give it a scale factor, and it returns the exact width and height your target should be, already rounded to a multiple of 8 so ComfyUI doesn't complain. It's a utility, not a headline feature, but it quietly removes a whole category of arithmetic errors from your workflow.

What it does

The node reads dimensions straight from tensor metadata. ComfyUI stores images as [batch, height, width, channels], so the node unpacks width and height directly from the shape. Latents are the interesting case: a latent tensor is stored at 1/8 resolution ([batch, 4, height/8, width/8]), because that's how much the VAE downsamples. The node knows this and multiplies the latent dimensions by 8 to get the real pixel size before scaling - which is exactly where people screw up by hand. Then it applies your scale_factor and rounds to the nearest multiple of 8, preserving aspect ratio the whole way.

Inputs and outputs

The inputs that matter:

  • scale_factor - FLOAT, 0.1 to 8.0, default 2.0. The one you'll actually set. 2.0 for a 2x upscale, 0.5 if you're building a preview pass.
  • image (optional) - an IMAGE tensor to read dimensions from.
  • latent (optional) - a LATENT to read dimensions from. Give it one or the other; handing it both is allowed, but it just reads the first it can.

Outputs are width and height as INTs. Wire them into an upscaler that takes explicit target dimensions, or into an Empty Latent Image for a second-pass hi-res generation.

Where it fits

Upscaling comes in two flavors and it's worth knowing which one you're doing (the KB's upscaling essay hammers this): more pixels - the image is already sharp and you just want it bigger, which is Lanczos or an ESRGAN model in milliseconds - versus more detail, which is a generative restorer like SUPIR or SeedVR2 and genuinely rewrites the image. Resolution Calculator is agnostic; it just computes the target size either pipeline needs. It shines when you're chaining: generate at 832Γ—1216, run it through a 1.5x pass to 1248Γ—1824, then tile-upscale to something absurd - and you never type a wrong number into the upscaler.

Installing it

Part of the ComfyUI-KikoTools pack:

  1. ComfyUI Manager β†’ search "ComfyUI-KikoTools" β†’ Install β†’ restart.
  2. Find it under ComfyAssets β†’ Resolution.

Or clone it:

cd ComfyUI/custom_nodes
git clone https://github.com/ComfyAssets/ComfyUI-KikoTools.git
cd ComfyUI-KikoTools
pip install -r requirements.txt

Restart ComfyUI. Zero extra model downloads for this one.

Gotchas

The main failure mode is feeding it nothing: if neither image nor latent is connected, the node raises "Either image or latent must be provided" rather than guessing. If your output comes back one pixel off your expectation, remember the latent path reads the stored 1/8-resolution shape - a latent built at 1024Γ—1024 reports 1024Γ—1024, not 128Γ—128. And one honest caveat: for plain 2x integer upscales you often don't need this at all. Where it earns its keep is fractional factors and latents, where the mental math genuinely goes wrong.

Category🫢 ComfyAssets/πŸ–ΌοΈ Resolution

Inputs (3)

NameTypeDefaultDescription
scale_factorFLOAT2.00.1–8Factor to scale the resolution by (e.g., 2.0 for 2x, 0.5 for half scale)
imageoptIMAGEInput image to calculate dimensions from
latentoptLATENTInput latent to calculate dimensions from

Outputs (2)

NameTypeDescription
widthINTβ€”
heightINTβ€”