𝙆 Image Size Extractor
Pull width and height out of any image
- image
- width
- height
A small, boring, extremely useful node: feed it an image, get its width and height back as integers you can actually wire into other nodes. That sounds trivial until you're building anything dynamic - resizing to match a reference image, scaling a mask to fit, driving a math expression off the input resolution - and you realize ComfyUI doesn't hand you those numbers by default without a node like this.
The pattern it unlocks is worth spelling out, because it's not obvious the first time you need it: say you're loading a reference image at some arbitrary resolution and want a generated image or an upscale pass to match it exactly, rather than hardcoding a fixed size. Without this node you're stuck typing numbers by hand every time your reference changes. With it, you extract width and height once and wire them straight into whatever resize or empty-latent node needs them - the workflow adapts to whatever image you feed it instead of needing to be re-edited each time.
How it works
It reads the tensor's shape directly, and it's written to handle both a single image (a 3D tensor) and a batch (a 4D tensor) without you needing to pick a mode - it just works either way. Because it's marked as an output node, the width and height also print right on the node itself, so you get a free sanity check of "yes, this is actually 1024×1536" without wiring in a separate display node.
The input and outputs that matter
- image (IMAGE) - the only input. Works on a single image or a batch.
- width (INT, output)
- height (INT, output)
That's genuinely the whole node. No settings to tune, nothing to get wrong on the input side.
Installing it
It comes bundled with the rest of KayTool - there's no standalone version. ComfyUI Manager: search KayTool, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/kk8bit/KayTool, then restart ComfyUI. Nothing extra to configure for this specific node once the pack is in.
Common issues
Honestly, there's not much to go wrong here - it's one of the simplest nodes in the pack. The only real gotcha is what you do with the output afterward: width and height come out as plain integers, so if you're chaining them into something expecting a different type (a float slider, a string for a filename), you'll need a conversion step - KayTool's own To Int won't help here since these are already ints, but abc Math is handy if you need to compute something off them (half the width, a rounded aspect ratio, etc.) before passing them on. If width/height come back as 0 or look wrong, the input almost certainly isn't a decoded image tensor yet - check that whatever's feeding this node is actually an IMAGE output and not, say, a LATENT that still needs a VAE Decode first.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |