Image Scale Restore (UTK)
Resize on the way down, put it back exactly on the way up
- image
- mask
- original_size
- image
- mask
- original_size
- width
- height
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, ortotal_pixel(kilo pixel)to target a total pixel budget.scale_to_length- the length used byscale_to_side, default 1024.round_to_multiple- snap the result to 8/16/32/64/128/256/512 orNone.
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 fromImageMaskScaleAs_UTKto 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.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| scale | FLOAT | 1.000.01–100 | — |
| method | COMBO | 6 options: lanczos, bicubic, hamming, bilinear, box, nearest | |
| scale_to_side | COMBO | 6 options: None, longest, shortest, width, height, total_pixel(kilo pixel) | |
| scale_to_length | INT | 10244–100000000 | — |
| round_to_multiple | COMBO | 8 options: 8, 16, 32, 64, 128, 256, +2 | |
| maskopt | MASK | — | |
| original_sizeopt | BOX | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| original_size | BOX | — |
| width | INT | — |
| height | INT | — |