ComfyUI Node Runs on cloud

ImageSize

Read an image's width and height as numbers

By yolain·Created 3 years ago·Updated 9 days ago· 2,633
ImageSize
  • image
  • width_int
  • height_int

Hand it an image, get back its width and height as two integers. That's the whole node - and it's one of those small utilities that quietly holds a workflow together, because the moment you want any downstream step to match an image's dimensions, you need those dimensions as numbers you can wire, not as a fact buried inside the pixels.

Why you'd reach for it

Dimensions are a dependency you don't want to hard-code. A few cases where this node is the fix:

  • Matching a later stage to the source. You load an image of unknown size and want the empty latent, the upscale target, or a resize step to use its exact width and height. Read them with easy imageSize, wire them onward, and the graph adapts to whatever you load instead of assuming 1024×1024.
  • Preserving aspect ratio through a pipeline. Feed the width and height into math (via easy mathInt) to scale both by the same factor, and the proportions survive.
  • Conditional logic. Compare the width against a threshold to decide whether an image needs downscaling before it hits an expensive stage.

It's the counterpart to nodes that make an empty latent from width/height: this one reads width/height off a real image so those numbers can flow.

The inputs and outputs

  • image (IMAGE) - the image to measure.
  • width_int (INT) - its width in pixels.
  • height_int (INT) - its height in pixels.

Both outputs are proper integers, so they drop straight into any width/height socket, a math node, or a comparison. There are no settings - it reports what's there.

Installing it

ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

then install the requirements (install.bat on Windows, else pip install -r ComfyUI-Easy-Use/requirements.txt) and restart. No models, no dependencies.

Common issues

  • A batch reports one size. If you feed a batch of images, they all share the same tensor dimensions, so you get a single width/height - the batch's, which is the size every image in it shares. This is normal; batched images in ComfyUI are always uniform in size. If you need per-image sizes for differently-shaped inputs, you're not dealing with a real batch (differently-sized images can't batch), so measure them individually.
  • Width and height, not aspect ratio. The node gives you the two raw pixel counts. If you want the ratio, that's a division you do yourself downstream - but for feeding resize and latent nodes, the raw integers are exactly what they want.
  • It's a terminal/display node too. It'll show the size on the node face when it runs, which is handy for a quick sanity check, but its real value is in the wired integer outputs.
CategoryEasyUse/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
width_intINT
height_intINT