CMK Smart Upscaler
One upscaler that picks 4x or 2x based on how big your image already is
- image
- image
- log_pipe
- diagnostic
The annoying thing about pixel upscalers is that you have to know which one to run. A 4x ESRGAN model on a 1024×1024 SDXL output gives you a 4096-pixel image, which is lovely until you notice it took four minutes and your card is wheezing. Run the 2x instead and you're at 2048, which is often exactly what you wanted. CMK Smart Upscaler makes that call by megapixel count for you.
The rule
You give it four things: the image, a 4x model, a 2x model, and two thresholds. Then:
- input ≤
limit_4x_mp(1.5 MP by default, so anything up to about 1440×1080) → the 4x model runs; - input ≤
limit_2x_mp(8 MP) → the 2x model runs; - input above
limit_2x_mp→ nothing runs at all. Passthrough, with a warning in the diagnostic that says so plainly.
That last branch is the one worth appreciating. Most upscale nodes in a chain will happily try to do something at 12 megapixels and then OOM at 3am mid-batch. This one refuses and tells you why.
Inputs: image, limit_4x_mp, limit_2x_mp, model_4x, model_2x. Both model dropdowns read from ComfyUI's upscale_models folder, so whatever ESRGAN or similar checkpoints you already have in ComfyUI/models/upscale_models show up. Outputs: image, log_pipe, diagnostic - the log and diagnostic carry the chosen scale, the reason, input and output megapixels, and a before/after stage pair you can read in the Visualizer.
What's happening under the hood
It loads the checkpoint through ComfyUI's own Chainner/Spandrel path and runs it with tiled inference at a 768-pixel tile with 32 pixels of overlap, and it halves the tile on an out-of-memory exception - down to 128, below which it gives up and re-raises. So it degrades instead of dying, which is the right behaviour for a card that's already holding a diffusion model.
One detail from the source worth knowing: the pipe-native sibling unloads diffusion models and clears the cache before loading the upscale network, with a comment about unified memory on macOS throwing VM-reclaim assertions when RealESRGAN construction happens while SDXL weights are resident. The standalone node you're reading about here doesn't do that, so on Apple Silicon or a tight VRAM budget, unload your checkpoint first - or use the pipe version in a CMK Flow chain where that's handled for you.
Installing
ComfyUI Manager → search CMK Flow → install the CMKFlow entry → restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/CMKFlow/cmk_nodes.git cmk_nodes
python3 cmk_nodes/scripts/install_cmk_requirements.py
CMK requires the Vue Nodes / Nodes 2.0 frontend setting. Model files are separate: your upscalers go in ComfyUI/models/upscale_models, and the pack's very large resource list (detectors, InsightFace, GFPGAN, RealESRGAN) is only relevant if you use its detection and face paths - scripts/check_cmk_resources.py will tell you what's missing.
Traps
Set model_4x and model_2x deliberately. If both point at the same 4x checkpoint, the "2x" branch will happily upscale by four and you'll get a 4096-pixel image from a threshold you thought was protecting you - the node doesn't validate the model's scale factor.
Then the ordering rule that the whole upscale discussion keeps coming back to: fix defects at native resolution first, then upscale. Upscaling a mangled face bakes it into more pixels and costs more to repair. Detailing before upscaling is not a style preference, it's the cheaper path, and the KB's upscaling notes say the same thing from the other direction. Finally, limit_4x_mp = 0 isn't a special "off" switch here - it just fails the first comparison, so everything falls through to the 2x band or the passthrough, which is fine but worth knowing if you were expecting a disabled state.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| limit_4x_mp | FLOAT | 1.50.5–100 | — |
| limit_2x_mp | FLOAT | 8.00.5–100 | — |
| model_4x | COMBO | 0 options: | |
| model_2x | COMBO | 0 options: |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| log_pipe | CMK_LOG_PIPE | — |
| diagnostic | CMK_DIAGNOSTIC | — |