Image Size
Dimensions, sides, and aspect ratio in one read — Image Size reports everything at once
- image
- width
- height
- max_side
- min_side
- aspect_ratio
You have an image and you need to know its dimensions - but really you need them as numbers the graph can use, not as numbers you read off a preview and retype. Image Size is the node that turns an image into its width, height, longer side, shorter side, and aspect ratio, all at once, as five clean outputs.
The mechanism is a tensor shape read with a little arithmetic on top. From the source: height and width come straight off image.shape, then max_side and min_side are the larger and smaller of the two, and aspect_ratio is width / height as a float. That's the whole node - no sampling, no resize, no model. It answers "what is this image?" in one read.
The single input:
- image - any image tensor.
The outputs:
- width - width in pixels.
- height - height in pixels.
- max_side - the longer edge (max of width and height).
- min_side - the shorter edge.
- aspect_ratio - width ÷ height as a float (so 1280×720 gives roughly
1.78, and a portrait 720×1280 gives roughly0.56).
Where it fits: the aspect-ratio math is the part most people actually want. The KB's concepts doc stresses that SDXL and friends were trained at discrete aspect ratios, and matching those buckets is how you avoid distorted anatomy - Image Size gives you the current image's ratio as a number you can feed into downstream sizing logic. Pair it with the pack's Aspect Ratios node and you can read an input's ratio, then regenerate at the same ratio but a different base height. Or wire width/height into a resize or an If branch that behaves differently for landscape vs. portrait.
It's the diagnostic sibling of the pack's Image Shape node: Shape reports batch, width, height, and channels; Size reports width, height, sides, and ratio. If you need the channel or batch count, reach for Shape; if you need geometry and ratio, this is the one.
Honest notes: aspect_ratio is computed as a float division, so it's exact-ish but not rounded - 1280/720 comes out 1.7777..., fine for feeding into math, annoying if you're eyeballing it. And the node reads the tensor's current shape, so feed it the image after any resize you care about.
Install is the standard pack path: ComfyUI Manager → search ComfyUI-FairLab → install → restart:
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, search "Image Size" or "image dimensions". No models, no dependencies - it's a shape read and a division.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| max_side | INT | — |
| min_side | INT | — |
| aspect_ratio | FLOAT | — |