[Inference.Core] Pixel Perfect Resolution
Stop guessing the resolution number on every preprocessor
- original_image
- RESOLUTION (INT)
Every preprocessor in this pack has a resolution field defaulting to 512, and most people just leave it there or eyeball a number. That's fine until your source image and your generation target are wildly different sizes - a low-res control map on a high-res generation loses detail, and an oversized one wastes compute for nothing. Pixel Perfect Resolution is the calculator that does this math for you: give it your original image's dimensions, your target generation dimensions, and how you're resizing between them, and it hands back the resolution number that actually makes the control map's pixel density match your generation. It's the same idea A1111 popularized as "Pixel Perfect" mode for ControlNet, as a standalone node here.
How it works
It's a pure arithmetic node, not a model - no download, no inference, just a calculation based on your original image's aspect ratio against your target generation size and the resize strategy you're using to get from one to the other. The three resize modes it supports (matching the standard ControlNet resize conventions) change how the math accounts for cropping versus padding versus plain stretching.
The inputs and outputs that matter
All four inputs are required - there's no optional side to this node:
original_image- your source image, used to read its actual dimensions.image_gen_width/image_gen_height(default 512 each) - your target generation size, i.e. what you're about to feed your sampler.resize_mode-Just Resize(default, stretches to fit, ignoring aspect ratio),Crop and Resize(crops to match aspect ratio, then resizes), orResize and Fill(resizes to fit within bounds, padding the rest).
One output: RESOLUTION (INT) - a single integer. Wire it into the resolution input of any preprocessor node in this pack (or elsewhere in comfyui_controlnet_aux-derived packs) instead of typing a number by hand.
How to install it
ComfyUI Manager: search ComfyUI-Inference-Core-Nodes, install, restart. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes
then run install.py, or pip install -e .[cuda12] (or .[cuda] / .[rocm] / .[directml] / .[cpu]) - though since this node does no inference at all, the plain pip install -e . with no extras is genuinely enough if this is the only node from the pack you're using. Restart ComfyUI.
Common issues & troubleshooting
The most common confusion is treating this as a preprocessor itself - it isn't one, and it produces no image. It only outputs a number, and that number does nothing on its own until you actually wire it into a real preprocessor's resolution input downstream.
Make sure resize_mode actually matches what you're doing elsewhere in your graph - if your workflow crops your image before generation but you tell this node Just Resize, the computed resolution won't reflect what's really happening to your image, and you'll get a subtly mismatched control map despite having "done the math." Pair this node with Generation Resolution From Latent (also in this pack) if you want image_gen_width/image_gen_height to auto-track your actual latent size instead of retyping numbers by hand every time you change your generation resolution.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| original_image | IMAGE | — | |
| image_gen_width | INT | 51264–8192 | — |
| image_gen_height | INT | 51264–8192 | — |
| resize_mode | COMBO | Just Resize | 3 options: Just Resize, Crop and Resize, Resize and Fill |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| RESOLUTION (INT) | INT | — |