Get image size
Read an image's width and height as numbers
- image
- WIDTH
- HEIGHT
Dead simple, and more useful than it looks: hand it an image, and it spits out the width and height as two integers you can wire into anything else. That's it. The reason it exists is that ComfyUI is a graph, and constantly you need to know how big something is so you can compute something else off it - a target upscale size, a matching empty latent, an offset for a paste. This node turns an image into numbers so the rest of your graph can do math.
It's from Derfuu_ComfyUI_ModdedNodes, a utility pack whose stated purpose is exactly this - "automate calculation depending on image sizes." This little node is the front door to that whole idea.
How it works
There's nothing to configure. It reads the tensor's dimensions and outputs them. One input, two outputs, no widgets.
image(IMAGE) - the input. Usually a Load Image, a VAE Decode, or any image mid-graph.- Outputs
WIDTH(INT) andHEIGHT(INT).
Those two INT outputs are the point. They plug straight into an Empty Latent Image, into math nodes like Multiply or Subtract, or into a scaler's size input.
Where you'd reach for it
The everyday pattern: you load an arbitrary user image and want the rest of the workflow to adapt to its size rather than a hardcoded number. Get image size → feed WIDTH/HEIGHT into an Empty Latent so your generation matches the input's dimensions. Or read the size, multiply by a factor, and drive a resize - a fully automatic "always upscale this by 1.5x whatever it is" chain with no manual numbers.
This is the kind of glue that makes a workflow reusable instead of hardcoded to one resolution. It's also worth knowing that the wider ecosystem has piled into this space - rgthree, KJNodes, and WAS Node Suite all ship get-dimensions nodes now, and rgthree's Power Puter can evaluate expressions inline. Derfuu was one of the early packs to make the graph programmable this way; this node still does the job fine and weighs nothing.
Common issues & troubleshooting
It outputs one number, not width×height. It outputs two - WIDTH and HEIGHT are separate ports. If you only see one, you probably only wired one; both are there on the node.
Numbers look 8x too small. That's not this node - you're probably thinking of Get latent size, where latent dimensions are 8x smaller than pixels. This node reads a pixel image, so the numbers are the real pixel dimensions.
Batch of images - which size do I get? All images in a batch tensor share dimensions, so you get that shared size. If your batch has mixed sizes it was already resized to match on load.
Install: ComfyUI Manager → search "Derfuu" → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes then restart. No models, no extra dependencies. If a Derfuu node ever goes red after an update, that's the pack's history of renaming/removing old classes - update it and re-add the node.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| WIDTH | INT | — |
| HEIGHT | INT | — |