Nodes/ComfyUI_AceNodes/πŸ… Image Get Size
ComfyUI Node

πŸ… Image Get Size

Ask an image how big it is, and wire the answer into the graph

By hay86Β·Created 2 years agoΒ·Updated about a year agoΒ· 96
πŸ… Image Get Size
  • image
  • WIDTH
  • HEIGHT

Every "does this resolution match?" moment in ComfyUI is you staring at an image and hoping. πŸ… Image Get Size removes the hoping: it takes an image, reads its width and height, and hands both back as typed integers you can wire straight into other nodes. It's a two-line read under the hood, and it quietly unlocks the whole class of "make the rest of the workflow adapt to whatever image arrived."

How it works

The single required input is image (IMAGE). Internally ComfyUI images are stored as (batch, height, width, channels) tensors, and the node just reads the height from index 1 and the width from index 2 of the batch's shape. Out come two integers, named helpfully: WIDTH and HEIGHT. No resizing, no decoding drama - the image passes through untouched (this is a pure read, not a converter).

Inputs and outputs

  • image - IMAGE, required.
  • Outputs: WIDTH (INT), HEIGHT (INT).

Where it shines

The classic move is wiring these into an EmptyLatentImage so your output resolution matches your input resolution automatically - change the input, and the latent follows. Same trick works for keeping a resize node in lockstep with whatever a preprocessor spat out. Because the outputs are typed integers, they plug into any INT port: latent dims, resize targets, or the pack's own πŸ… Text To Resolution reverse (which goes text β†’ numbers; this goes image β†’ numbers).

Install

Ships in hay86/ComfyUI_AceNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/hay86/ComfyUI_AceNodes
cd ComfyUI_AceNodes
pip install -r requirements.txt

Restart ComfyUI and find πŸ… Image Get Size under Ace Nodes. Manager users search ComfyUI_AceNodes.

Gotchas

A couple of honest notes. First, the size it reports is the size of the tensor, which for most workflows is the actual pixel size - but if something upstream has resized the image in a latent or via a preview, the tensor may not match what you see on screen. Second, this reads the first image of a batch's dimensions; a mixed-size batch isn't really a thing in ComfyUI anyway, so that's fine in practice. And the pack's heavy requirements.txt (rembg, transformers, boto3…) installs even for a node this small. For adaptive workflows, it's one of those tiny nodes that punches well above its weight.

CategoryAce Nodes

Inputs (1)

NameTypeDefaultDescription
imageIMAGEβ€”

Outputs (2)

NameTypeDescription
WIDTHINTβ€”
HEIGHTINTβ€”