Generation Resolution From Image
Read a reference's dimensions into width/height ints
- image
- IMAGE_GEN_WIDTH (INT)
- IMAGE_GEN_HEIGHT (INT)
A tiny, boring, genuinely useful utility. It reads the width and height of an image and outputs them as two integers. That's it. Why would you want that? Because in a ControlNet workflow your generation should usually match the aspect ratio of your control image - if your pose reference is 768×512, generating at a square 512×512 squashes everything. This node lets you wire your reference image's real dimensions straight into your latent (or into a resize node) so the output matches automatically, no hand-typing numbers, no accidental stretching.
How it works
There's no model and no processing to speak of - the node inspects the input image and pulls its pixel dimensions. It hands you back two INT outputs: the width and the height. You feed those into whatever needs a resolution: an Empty Latent Image node, a resize, a math node that scales the target up or down. The whole point is to keep the control map, the latent, and the final image in the same aspect ratio without you managing it manually. In a ControlNet graph, mismatched aspect ratios are one of the quiet ways results go subtly wrong, and this node removes that class of mistake.
The inputs and outputs
As minimal as it gets:
image(IMAGE) - the reference whose dimensions you want to read.
Outputs are two integers: IMAGE_GEN_WIDTH (INT) and IMAGE_GEN_HEIGHT (INT). Wire them wherever a width and height are needed.
Installing it
ComfyUI Manager: search ComfyUI's ControlNet Auxiliary Preprocessors, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/comfyui_controlnet_aux
pip install -r requirements.txt
Restart ComfyUI. No model download, nothing to configure - it works the instant the pack loads.
Where people get burned
Almost nothing to trip over, which is the nice thing about it. The one gotcha is that it hands you the image's exact dimensions, and your model may want them snapped to a multiple of 8 (or 64) - if you feed an odd size straight into a latent you can get an error or a silent resize. If that bites, drop a small rounding/resize step between this node and your latent. Also note it has a sibling, ImageGenResolutionFromLatent, for when your reference is already a latent rather than a pixel image - same idea, different input type. Otherwise, this is exactly what it looks like: a convenience node that keeps your resolutions honest.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE_GEN_WIDTH (INT) | INT | — |
| IMAGE_GEN_HEIGHT (INT) | INT | — |