GetImage_(Width&Height) _O
Read an image's real dimensions as numbers
- image
- INT
- INT
You'd think "what size is this image?" would be something you could always see. In ComfyUI, the answer lives inside a tensor, and until you pull it out you can't use it to drive anything. GetImage_(Width&Height) _O does exactly that: feed it any IMAGE and you get two INT outputs - width and height - that you can wire into other nodes as real values.
It's one of the O/numbers nodes in the Quality of Life Suit, and it's the answer to a surprisingly common workflow problem: you load an image, you want to scale it to half its own size, and you need the original dimensions as numbers to compute that. The ImageScaleFactor _O nodes in the same pack handle the factor case, but when you need an exact derived size - say, "make my canvas exactly the same width as this loaded image" feeding a latent or a Text2Image _O canvas - this is the node that hands you the raw numbers.
How it works
Mechanically it reads the image tensor's shape: after moving the channel axis, shape[3] is width and shape[2] is height, returned as plain INTs. First output is width, second is height - no labels beyond the type, so just remember the order. (If you mix them up, the result is usually harmless; aspect ratios stay the same when both get swapped.)
The inputs that matter
image- required, anyIMAGE. That's it. No widgets to fiddle with.
Outputs: INT (width), INT (height).
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
or search ComfyUI-QualityOfLifeSuit_Omar92 in ComfyUI Manager, then restart ComfyUI. No dependencies.
Where it fits (and the one caveat)
A natural pairing: read the width/height of your input, feed them through the pack's intToFloat _O if a downstream node insists on floats, multiply to get a target, and wire into a latent or scale node. The caveat is the same one that bites everyone new to the graph: this reads the image tensor's dimensions in pixels. That's what you want for decoded images. If you're working with a latent, use the sibling node GetLatent_(Width&Height) _O instead - and remember latent dimensions are the compressed resolution, not the final pixel size, so don't mix the two up mid-workflow.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |
| INT | INT | — |