Smart Upscale Calculator
Tells you how big your texture should be, and whether to upscale at all
- image
- width
- height
- scale_factor
- needs_upscale
Smart Upscale Calculator (AIXPOLY_SmartUpscaleCalculator) doesn't resize a single pixel. It computes numbers - and for the workflow this pack is built around, the numbers are the point.
You feed it an image and pick a target resolution from 1k, 2k, or 4k. It reads the image's dimensions, works out the aspect-preserving target size, calculates the scale factor needed, and - the useful bit - tells you whether any upscaling is needed at all. It's the decision-maker in a chain that ends with Conditional Upscale actually running the model.
Why it exists
PBR texture work has a real constraint that image generation mostly ignores: game engines and renderers want textures at standard sizes, typically 1K (1024), 2K (2048), or 4K (4096), and ideally powers of two. The pack's whole reason for being is producing material maps, so it ships a node that turns "whatever size my depth map came out at" into "the size my target expects." It also encodes a sensible reality check: there's no point 4x-upscaling a 512px source when you only need a 1K texture - that just wastes VRAM and time.
How it works
The math is transparent. It maps your choice to a target max side - 1K → 1024, 2K → 2048, 4K → 4096 - then:
scale_factor = target_max / current_max_side
capped at 4.0, so a tiny input can't be asked for an insane jump. Output dimensions are the input dimensions times that factor, preserving aspect ratio. needs_upscale is simply scale_factor > 1.0 - i.e., the target is bigger than your source.
Inputs and outputs
image- any image; only its dimensions are read.target_resolution- a dropdown, default2k.
Outputs are the four numbers that matter: width, height, scale_factor, and needs_upscale (a boolean).
The classic wiring: run needs_upscale into Conditional Upscale's enable, and feed scale_factor into an upscale-by-factor node so the image lands exactly at the computed size. You can also route width/height into the pack's Clamp Resolution node for a final cap. This is the node that makes the rest of the pipeline self-adjusting: same workflow file, different source sizes, and the texture always comes out the size you asked for.
Install
It ships in the ComfyUI-PBRFusion4 pack, so install is the same as its siblings. In ComfyUI Manager, search "ComfyUI-PBRFusion4" and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Night1099/COMFYUI-PBRFusion4
Restart ComfyUI. This node is pure math - it doesn't load the pack's 4.1 GB model, so it works even before any model download, and it runs instantly.
Gotchas
- It only computes. Nothing is resized here. If you wire the outputs nowhere, nothing happens - which is by design, but it's the most common "is this broken?" moment.
- The cap is real. If your source is 512px and you pick 4K, you get a 4x scale, not a 4096px output -
width/heightreflect the capped scale, not the naive target. That's intentional; the node assumes your upscaler can't be trusted past 4x. - Dependency note: the whole pack fails to load if
opencv-python-headlessisn't installed (it's imported at pack load time), so if this node doesn't appear, install the pack's requirements and restart.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_resolution | COMBO | 2k | 3 options: 1k, 2k, 4k |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| scale_factor | FLOAT | — |
| needs_upscale | BOOLEAN | — |