ImagePixelPerfect
The resolution math A1111 users miss most in ComfyUI
- image
- resolution
"Pixel Perfect" was one of the small quality-of-life features in A1111's ControlNet extension that people missed most when they moved to ComfyUI - a button that just figured out the right preprocessor resolution for you instead of making you eyeball it. This node is that feature, ported over: feed it an image, tell it how you want the resizing handled, and it outputs the resolution number your preprocessor should actually use.
Why this matters for ControlNet specifically
Every ControlNet preprocessor (Canny, depth, pose, whatever) runs at some working resolution, and that resolution needs to roughly match your target generation size or you get a blurry, oversized, or undersized hint map that fights your model instead of guiding it. Getting this right by hand means doing aspect-ratio math every time your source image or target size changes. This node does that math once and hands you back a single number to plug into your preprocessor node's own resolution field.
The inputs and outputs that matter
Just two required fields. image is the source you're computing a resolution for. resize_mode is the interesting one, and it's a direct port of A1111 ControlNet's own three resize strategies:
- Just Resize - stretches the image to fit, ignoring aspect ratio. Simple, can distort.
- Crop and Resize - crops to match the target aspect ratio first, then resizes. No distortion, but you lose some of the frame's edges.
- Resize and Fill - resizes to fit within the target while preserving aspect ratio, then pads the rest. No distortion, no cropping, but you get padding to account for.
The output is a single resolution (an INT), and this node is flagged as an output node - you can preview it directly, but its real job is to feed straight into the resolution input on whatever preprocessor node comes next in your ControlNet chain.
Installing it
ComfyUI Manager: search ComfyUI Easy Use, install, restart. By hand:
cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use
Windows: double-click install.bat. Linux/Mac: cd in and run pip install -r requirements.txt yourself - nothing does it automatically there. Restart ComfyUI. No model weights involved with this specific node; it's pure arithmetic.
Where people get stuck
The main mistake is treating resize_mode as cosmetic when it isn't - it changes what data actually reaches your preprocessor. If your ControlNet condition looks subtly wrong at the edges of the frame, check whether you're on Crop and Resize and losing content you expected to keep; switch to Resize and Fill if you need the whole source preserved. The second common mix-up is forgetting this node only outputs a number, not a resized image - you still need to wire that resolution output into your preprocessor's own resolution field for it to do anything; dropping this node into a graph and not connecting its output anywhere is a silent no-op. And if you're chasing genuinely crisp control maps, remember the resolution this node computes is a starting point, not a guarantee - very high-detail conditions (dense lineart, tile) still benefit from pushing resolution above what "pixel perfect" math alone suggests.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| resize_mode | COMBO | Just Resize | 3 options: Just Resize, Crop and Resize, Resize and Fill |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| resolution | INT | — |