Nodes/ComfyUI-UniversalToolkit/Image Scale Restore (UTK)
ComfyUI Node

Image Scale Restore (UTK)

Resize on the way down, put it back exactly on the way up

By whmc76·Created about a year ago·Updated 2 months ago· 72
Image Scale Restore (UTK)
  • image
  • mask
  • original_size
  • image
  • mask
  • original_size
  • width
  • height
scale1.00
method
scale_to_side
scale_to_length1024
round_to_multiple

Lots of pipelines work small and finish big: shrink the image for a fast controlnet pass, do the work, then scale back up to the original resolution for output. The annoying part is remembering what the original resolution was. Image Scale Restore (UTK) is the "scale back up" half of that pattern - and if you feed it the original_size box that its sibling ImageMaskScaleAs_UTK emits, it restores exactly the original dimensions, mask included. Round trip, no bookkeeping.

It's from ComfyUI-UniversalToolkit, and it's the mirror image of the pack's scaling nodes. It can also work standalone as a general resize, which is how most people end up using it at first.

How it works

The node has two ways to pick the target size. The good way: pass an original_size BOX into the optional input, and it just uses those width/height - that's the "restore" behavior the name promises. The standalone way: it computes a target from the other controls:

  • scale - plain multiplier (0.01–100).
  • scale_to_side - longest, shortest, width, height, or total_pixel(kilo pixel) to target a total pixel budget.
  • scale_to_length - the length used by scale_to_side, default 1024.
  • round_to_multiple - snap the result to 8/16/32/64/128/256/512 or None.

Any target below 4px gets bumped up to 4, and the method dropdown picks the sampler (lanczos default). The optional mask is resized in lockstep, so an image/mask pair stays aligned through the whole round trip.

Outputs are image, mask, then original_size (the image's original dimensions, reported back as a BOX), width, and height. Note the subtlety: the original_size output is the pre-resize size, not the target - so if you feed in an original_size box, the output box echoes the same dims back. The width/height outputs are the actual final size.

Inputs and outputs that matter

  • original_size (BOX, optional) - feed this from ImageMaskScaleAs_UTK to restore exactly.
  • scale + scale_to_side/scale_to_length - for standalone resizing.
  • round_to_multiple - handy when a sampler needs multiples of 8/16.

Install and gotchas

Install via ComfyUI Manager (search "ComfyUI-UniversalToolkit") or:

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

Restart ComfyUI. No models, no keys.

The main trap is thinking "restore" means "upscale with AI." It doesn't - this is resampling, the "more pixels" job from the upscaling playbook, not the "more detail" job. If the image you restored up looks soft, that's inherent to interpolation; run a real upscaler after if you need detail back. Second trap: scale multiplies the current size, but if you also set scale_to_side, the explicit side rule wins - so don't set both and wonder which one fired.

CategoryUniversalToolkit/Image

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
scaleFLOAT1.000.01–100
methodCOMBO6 options: lanczos, bicubic, hamming, bilinear, box, nearest
scale_to_sideCOMBO6 options: None, longest, shortest, width, height, total_pixel(kilo pixel)
scale_to_lengthINT10244–100000000
round_to_multipleCOMBO8 options: 8, 16, 32, 64, 128, 256, +2
maskoptMASK
original_sizeoptBOX

Outputs (5)

NameTypeDescription
imageIMAGE
maskMASK
original_sizeBOX
widthINT
heightINT