Upscale Image (using Model)
Skip the upscale pass when the image is already big enough
- upscale_model
- image
- IMAGE
If your workflow processes images of wildly different starting sizes - some already 2K, some barely 512px - running every single one through a model upscale is wasted work on the ones that don't need it. UpscaleImageWithModelIfNeed is ComfyUI's own ImageUpscaleWithModel with one addition: it checks the image's size first, and skips the upscale entirely if the image already clears a threshold.
What it's for
This belongs squarely in the "more pixels" category of upscaling - plain model-based super-resolution (ESRGAN-family models like 4x-UltraSharp are the usual pick here), not a generative detail-adding pass like SUPIR or SeedVR2. It adds no content and can't hallucinate detail; it just makes the image bigger. That distinction matters for when this node is actually useful: it's a compute-saving gate on a mechanical resize step, not something that decides whether your image needs restoration.
The README describes exactly why it exists: "Enhanced the official UpscaleImageWithModel node by adding a judge. If the input image area exceeds a predefined threshold, upscaling is bypassed. The threshold is a percentage of the SDXL standard size (1024×1024) area." In practice: under the hood, this node subclasses ComfyUI's own upscale node, so it inherits the exact same upscaling behavior when it does run - the only thing layered on top is the size check.
How it works
Before running the (relatively expensive) model upscale, it computes the input image's area and compares it against a threshold derived from the standard SDXL resolution (1024×1024 ≈ 1 megapixel). If the image is already at or above that bar, the upscale step is bypassed and you get the original image back unchanged. If it's below, the upscale model runs exactly as it would with the vanilla node.
The inputs and outputs that matter
upscale_model(UPSCALE_MODEL, required) - load this the same way you would for the stock node, typically via an Upscale Model Loader pointed at an ESRGAN-family checkpoint.image(IMAGE, required) - the image to conditionally upscale.
That's the entire input list - no exposed threshold parameter. The size check is baked into the node rather than left as a setting you tune, which is worth knowing going in: if you were expecting a "threshold" widget to appear, it's not there, because the node makes that call internally against the SDXL-standard-size percentage described in the README.
Output: a single IMAGE - either the freshly upscaled result, or your original image passed straight through if it was already big enough.
How to install it
Via ComfyUI Manager: search "ComfyUI-utils-nodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. No extra dependencies for this node itself - but you still need an actual upscale model file (a .pth ESRGAN-family checkpoint, the same kind the stock node uses) placed in your models folder and loaded via an Upscale Model Loader before this node has anything to run.
Common issues & troubleshooting
Because there's no exposed threshold, you can't tune where the cutoff sits from the node's UI - if you need a different threshold than what's baked in, you'd be better served chaining the stock ImageUpscaleWithModel behind an explicit size-comparison node instead (this same pack's MaskAreaComparison measures mask area rather than image area, so it's not a direct fit here, but the same "compare then switch" pattern applies with a general-purpose dimension check).
The other thing to keep straight: this only saves you the upscale pass, not the model load. If you're running this in a loop over a folder of images, the upscale model itself still gets loaded regardless of whether any individual image ends up needing the pass - the savings are per-image compute during upscaling, not the setup cost of having the model in memory at all.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| upscale_model | UPSCALE_MODEL | — | |
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |