Nodes/JPS Custom Nodes for ComfyUI/Get Image Size (JPS)
ComfyUI Node

Get Image Size (JPS)

Read an image's width and height as plain numbers

By JPS-GER·Created 3 years ago·Updated 2 years ago· 100
Get Image Size (JPS)
  • image
  • width
  • height

This is the node you reach for when you have an image in your graph and you need its dimensions as actual numbers you can do math on, not just something you eyeball in a preview window. It's about as small as ComfyUI nodes get, and that's the point - it's a plumbing fitting, not a feature.

Feed it an image, and it hands back two plain integers: width and height. No resizing, no cropping, nothing touches the pixels - it just reads the tensor shape and reports it. That means it's essentially free to run and you can drop it anywhere in a graph without worrying about it slowing anything down.

Why you'd want this instead of just looking at the image. The moment you're doing anything conditional on image size - deciding how much to upscale, snapping a loaded photo onto SDXL's trained aspect ratios, or driving a downstream crop to match a target canvas - you need those dimensions as live data flowing through the graph, not a number you read off a preview and hardcode into a widget. Hardcoded numbers break the instant you swap the input image for a different one; wired numbers don't.

Where it plugs in. The obvious pairing, and the one the pack's own README calls out directly, is feeding these outputs into Resolution Multiply (to compute a clean 2x/4x upscale target) or SDXL Recommended Resolution Calc (to find the nearest SDXL-trained resolution for an img2img or ControlNet source image that didn't come out of an Empty Latent Image node). If you're building an img2img pipeline where the input photo could be any size, this node is usually the first thing touching that image before anything downstream tries to reason about proportions.

Installing it. Either search "JPS Custom Nodes for ComfyUI" in ComfyUI Manager, or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git

Restart ComfyUI afterward and it appears under JPS Nodes/Image. If you're upgrading from an older copy of the pack, delete the old folder first - the author flags this explicitly to avoid duplicate class-name conflicts. There's no model to download and no extra Python dependency beyond what ComfyUI ships with; it's reading a tensor's .shape, nothing more.

Troubleshooting. Genuinely not much to trip over here - the node either has an image connected or it doesn't. If width/height come back looking wrong (swapped, or half what you expected), the more likely culprit is upstream: a Load Image node that auto-resized on import, or a batch of images with mismatched dimensions being treated as one tensor. Check what's actually landing on the image input before assuming this node is misreporting - it isn't doing anything clever enough to get it wrong on its own.

CategoryJPS Nodes/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
widthINT
heightINT