Get Image Size
Get Image Size
- image
- width
- height
get_size reads the width and height off an image and hands them out as two integers. That's the whole node. It's plumbing - but it's the kind of plumbing that makes half your other nodes work without hardcoding numbers.
Why you'd reach for it
The moment your workflow has to react to an image's dimensions instead of assuming them, you need this. Load a user-supplied image and want to generate a latent at the same size? Pull width and height from get_size, feed them into an Empty Latent. Want to resize something back to its original dimensions after a detour? Grab the size before the detour and reuse it. Doing math on the resolution - halving it, matching an aspect ratio, computing a crop box, placing a composite at the right offset? It all starts with knowing the actual width and height as numbers you can wire.
Without a node like this you end up typing dimensions in by hand, which breaks the instant the input image changes. get_size makes the workflow adapt to whatever comes in.
How it works
There's no cleverness here. It looks at the input image tensor and returns its pixel width and height as integers. If you pass it a batch, it reports the dimensions of the images in that batch (they share a size within a batch).
The inputs and outputs
- image - the image to measure. The only input.
Outputs are two integers:
- width - pixel width.
- height - pixel height.
Both are plain INTs, so they wire into anything that takes an integer: latent size fields, resize nodes, math nodes, offset inputs on a composite. This pack's Percentage of Total node pairs with it nicely when you want a fraction of a dimension.
Installing it
ComfyUI Manager → search antrobots ComfyUI Nodepack, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/antrobot1234/antrobots-comfyUI-nodepack
Nothing to download - it's a one-line utility.
Common issues
There's very little to go wrong here. The one thing worth knowing is the width/height order - the node gives you width first, then height, so double-check you're not wiring them backwards into a node that expects height first. A silently transposed image (portrait where you meant landscape) is almost always crossed wires between these two outputs.
Beyond that: if you feed it into an Empty Latent for SD generation, remember most models want dimensions that are multiples of 8 (or 64). get_size reports the true pixel size, which might not be cleanly divisible - if your latent node complains, round the value with a math node before passing it on.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |