Nodes/ComfyUI-Image-Resizing/Image Resolution Extractor
ComfyUI Node

Image Resolution Extractor

The node that answers 'how big is this?' as a number you can actually wire somewhere

By Zar4X·Created about a year ago·Updated 14 days ago· 5
Image Resolution Extractor
  • image
  • pixels
resolutionwidth

Image Resolution Extractor is the humblest node in the ComfyUI-Image-Resizing pack, and I mean that as a compliment. It does exactly one thing: it looks at an image, and hands you one of its dimensions as an integer you can plug into something else.

That sounds trivial until you try to build a workflow that depends on image size at runtime. In ComfyUI, dimensions live inside tensors - you can't read them by eye in the middle of a batch, and you can't do arithmetic on something you don't have as a number. Want to compute "half this image's width," check "is the shortest side under 768," or log the resolution of every frame in a batch to a text widget? First you need the number out. This node is that step.

How it works

Feed it an image and pick a resolution mode - width, height, shortest side, or longest side - and out comes a single pixels integer. That's the whole thing. The author's own description is accurate: "Extracts specific resolution values from input images. Options: shortest side, longest side, width, or height."

One implementation detail worth knowing: it reads the dimensions of the first image in the batch and assumes the rest match. That's fine for the 99% of workflows where a batch is uniform, but if you're feeding it a mixed-size batch, it'll report the first frame's numbers and not tell you it lied.

Where it earns its place

The output is an INT, so it plays with the rest of ComfyUI's graph the way any number does. Common patterns:

  • Wire pixels into a math or primitive node to derive a half-size, quarter-size, or a scale factor to pass to a resize node.
  • Feed it into a text-template node so your workflow prints the actual resolution next to the saved image - handy when you're sanity-checking a batch.
  • Use it as the "measure" step in a conditional: shortest side below a threshold → upscale path, otherwise pass through.

Paired with the pack's aspect ratio extractor, it gives you both halves of the "what shape am I actually working with" question - the raw numbers here, the ratio as text there.

Install

Same story as the rest of the pack - no models, no heavy dependencies, just torch/Pillow/numpy/OpenCV that you already have. ComfyUI Manager (search "ComfyUI-Image-Resizing"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Zar4X/ComfyUI-Image-Resizing

Restart and it appears under Image Resizing/Resolution. It's a utility, not a showpiece - you'll forget it's there until the day a workflow absolutely needs a size as a number, and then you'll be glad it is.

CategoryImage Resizing/Resolution

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
resolutionCOMBOwidth4 options: shortest side, longest side, width, height

Outputs (1)

NameTypeDescription
pixelsINT