Nodes/zsq_prompt/Image Size
ComfyUI Node

Image Size

The Image Size Node That Feeds the Rest of Your Graph

By windfancy·Created 2 years ago·Updated 5 months ago· 2
Image Size
  • image
  • width_int
  • height_int

imageSize answers one question: how big is this image? Width and height, as integers, ready to be wired into anything that needs to know. It doesn't resize, crop, or touch a single pixel - it's a measurement node, the graph's way of asking an image "what are your dimensions?" so downstream nodes can make decisions off the answer.

How it works

ComfyUI images are tensors, and the node simply reads the tensor's shape - the height and width from the batch/width/height/channel layout - and hands them back as width_int and height_int. Nothing is resampled, nothing is cached; it's a pure read, which means it's effectively free to run and safe to drop into any workflow.

The inputs and outputs

One input: image. Two outputs: width_int and height_int. That's the whole API, and the values are ready-made for the pack's IntMathOperation - the classic pattern is: read an image's width, halve it, feed the result into a crop or a resize. It's also how you enforce that a generated image matches a reference's exact dimensions without typing them in by hand.

Where it earns its place

The real value is in workflows that adapt to their input. Load a reference, read its size, and drive an imageConcat, a resize, or this pack's checkpoint_sampler resolution from those numbers - your pipeline stops assuming and starts measuring. That's the difference between a workflow that only works at 512×512 and one that works on whatever you throw at it. Pair it with imageRatio (which reports the same image's aspect ratio as reduced integers) and you can answer both "how big" and "what shape."

Installing it

Part of windfancy/zsq_prompt - search "zsq_prompt" in ComfyUI Manager and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/windfancy/zsq_prompt

then restart. Heavy dependencies install alongside (transformers, ultralytics, onnx) that this node never touches. And if Manager flags zsq_prompt as "conflicting," that's the pack's generic class names colliding in the manager's index - ignore unless you're actually running the other pack too.

Verdict

The most boring node in the pack, and one of the more useful. Measurement nodes are invisible until they're missing, and this one is a clean implementation.

CategoryZSQ/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
width_intINT
height_intINT