PD:GetImageSize
GetImageSize — the node that finally tells you what size that image actually is
- image
- width
- height
You'd think ComfyUI would tell you an image's dimensions somewhere obvious. It kind of doesn't - the image comes off the wire as an IMAGE tensor and the only way to know its size is to squint at the preview. PD:GetImageSize fixes exactly that: plug in any image and it hands you the width and height as plain integers, plus prints them on the node so you can actually see them.
This is plumbing, and plumbing is the honest description of 70% of ComfyUI (see the node-plumbing essay in the KB - value nodes exist to fight repetition and illegibility). Where it shines is wiring. A size-as-integers output lets you feed dimensions into other nodes instead of typing them, so your resize, crop, or prompt-building logic follows the actual image instead of a guess you made an hour ago.
How it works
The node reads the tensor shape straight from the IMAGE input - image.size() gives you [batch, H, W, C], and it reports index 2 as width and index 1 as height. One important property: a ComfyUI image batch is rectangular by definition, so if you feed it a batch of a hundred images they're all the same size and you get that one size back. If you've got mixed-size images on your hands, separate them into uniform batches first.
It's also flagged as an output node, which is the nice part: after each run it writes Width: 1024, Height: 1024 (or whatever) directly onto the widget, so it doubles as a live readout while you're building.
The inputs and outputs that matter
There's one input and two outputs, that's the whole node:
- image (
IMAGE) - whatever you want measured. - width (
INT) and height (INT) - the two numbers.
Wire those into a text join to build a filename prefix like img_1024x1024, into PD:ratio selector to drive a consistent canvas size, or into PDImageResize if you want to scale relative to current size rather than to a fixed value. That last one is the move: resize-to-50%-of-current is just "read the size, multiply by 0.5" in the graph, and this node is the read.
Install
ComfyUI Manager: search for PDuse (repo is 7BEII/Comfyui_PDuse), install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/7BEII/Comfyui_PDuse
cd Comfyui_PDuse
pip install -r requirements.txt
Then restart ComfyUI. The requirements file (numpy, Pillow, torchvision, opencv-python, scipy, xlrd, openpyxl) is mostly stuff your ComfyUI env already has, so this rarely breaks anything.
Gotchas
There aren't many - it's a size reader. The one thing people trip on: don't expect it to tell you the size of the file on disk or its aspect ratio. It reports pixel dimensions of the tensor, full stop. If you need the aspect ratio as a string, that's the sibling PD:GetImageRatio node in the same pack. And because it's marked as an output node it has no downstream use beyond the wire - you still route width/height to wherever you need them.
Keep it in a corner of any workflow where downstream sizes matter. It's the kind of node that feels pointless until the moment it saves you from hardcoding "1024x1024" everywhere.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |