Nodes/Comfyui-ergouzi-Nodes/2🐕Image size acquisition
ComfyUI Node

2🐕Image size acquisition

Read an image's width and height as numbers you can reuse

By 11dogzi·Created 2 years ago·Updated 2 years ago· 102
2🐕Image size acquisition
  • image_in
  • width
  • height

There's no cleverness here, and it doesn't need any. Image size acquisition takes an image in and tells you its width and height as numbers, so the rest of your graph can react to a dimension it doesn't already know. That's a more common need than it sounds - plenty of workflows load an input image of unknown size and then need to build an empty latent, a resize target, or a crop region that matches it, and without a node like this you're stuck hardcoding numbers that only work for the one image you tested with.

How it works

One required input, image_in, typed IMAGE. Two outputs, width and height, both plain INT. Wire the image in from wherever it's loaded - a Load Image node, the output of a previous processing step, whatever - and wire the two integer outputs anywhere a downstream node expects a width or height: an empty latent, an upscale node, a crop node, a math node if you need to derive something like an aspect ratio from them.

What to actually set

Nothing - there's no widget on this node besides the connection itself. Its entire job is reading and reporting. That's exactly why it's worth having in the toolbox: the moment you stop generating from a fixed empty latent and start working from user-supplied or externally-loaded images (img2img, upscale pipelines, batch processing a folder of mixed sizes), you no longer know your dimensions ahead of time, and every downstream node that needs a width or height has to get it from somewhere. This is that somewhere. Pairing it with this pack's own "Proportional empty Latent" node is a natural combo - read an input image's size here, feed it in as the base width/height there, and your latent tracks whatever image actually came in instead of a number you typed once and forgot to update.

Where it saves you the most time

Anywhere you'd otherwise be tempted to hardcode a resolution "because that's what my test image happened to be." A crop node, a resize target for a second image you want to match, a math node computing an aspect ratio to feed into a conditional - all of them are more robust wired to this node's outputs than to a number typed once and left stale after the input changes.

Installing it

ComfyUI Manager: search "Comfyui-ergouzi-Nodes", install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-Nodes.git

then restart ComfyUI. No models, no dependencies - this reads dimensions off a tensor that's already in memory, so it's effectively instant. Same standing note as the rest of the pack: the English repo is the frozen branch, with the author's active development happening in a separate Chinese-first sibling repo.

Common issues & troubleshooting

There's genuinely very little that goes wrong with a node this simple. The one thing worth knowing: if your image_in comes from a batch (multiple images in one tensor), the width and height it reports describe a single frame's dimensions, not anything about the batch count - if you need the batch size itself, that's a separate value this node doesn't provide, and you'd get it from whatever node produced the batch in the first place.

Category2🐕/🖼️Image

Inputs (1)

NameTypeDefaultDescription
image_inIMAGE

Outputs (2)

NameTypeDescription
widthINT
heightINT