Nodes/ComfyUI/Get Image Size
ComfyUI Node Runs on cloud

Get Image Size

Get Image Size

By Comfy-Org·Created 4 years ago·Updated 21 days ago· 121,575
Get Image Size
  • image
  • width
  • height
  • batch_size

You loaded an image, and now three nodes downstream something needs its width and height as actual numbers - to build a matching empty latent, to compute a crop, to feed a resize. Get Image Size is the little utility that reads those numbers off any IMAGE and hands them to the rest of your graph. Boring, load-bearing, and in most workflows you'll want one.

Why you'd reach for it

ComfyUI passes images around as tensors; the pixel dimensions are in there but not exposed as wires you can plug into a math or latent node. This node cracks the image open and gives you the width, height, and batch size as plain integers. That's the whole job. It shines whenever a downstream node needs to know the input's size at runtime rather than a value you typed - an img2img pass that must match the source, a paste-back after inpainting, or any workflow that accepts arbitrary user uploads.

How it works

It inspects the image tensor and returns its dimensions. No resampling, no processing - it's a read. If you feed it a batch of images (say, video frames), the batch_size output tells you how many are in the stack, which is useful for looping or for sizing the nodes that come after.

Inputs and outputs

There's exactly one input, image, and three outputs: width, height, and batch_size, all integers. Wire width and height into an Empty Latent, a Simple Math node, or an Image Resize; wire batch_size wherever you're iterating over frames. That's it - there are no settings to get wrong.

Installing it

Here's the useful surprise: you almost certainly already have this. Get Image Size now ships inside ComfyUI core (it lives in comfy_extras, not a custom pack), which is exactly the fate cubiq hoped for when he wrote the Essentials pack - the README literally says he expected it to be "a temporary repository until the nodes get included into ComfyUI." Get Image Size is one of the ones that made it in.

So in a fresh, up-to-date ComfyUI you don't need to install anything - it's under the image category already. If you're on an older build or a workflow references the Essentials variant, grab the pack via ComfyUI Manager (search ComfyUI Essentials) or:

cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials

and restart. Either way you get a node with the same three outputs.

Common issues

Two things trip people up. First, if a shared workflow can't find the node, it's likely calling the older Essentials class name while you have core (or vice versa) - swap in whichever "Get Image Size" your menu offers; the wiring is identical. Second, remember the outputs are the input image's dimensions, before any resize you do later. If you need the size after a resize, read it from the resize node's own width/height outputs (Essentials' Image Resize provides those) rather than adding a second Get Image Size - same number, one less node.

Categoryimage

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (3)

NameTypeDescription
widthINT
heightINT
batch_sizeINT