Nodes/ComfyUI Easy Use/ImageSize (LongerSide)
ComfyUI Node Runs on cloud

ImageSize (LongerSide)

Read an image's long-edge resolution

By yolain·Created 3 years ago·Updated 12 days ago· 2,647
ImageSize (LongerSide)
  • image
  • resolution

A one-job node: give it an image, it tells you the length of the longer side - width or height, whichever is bigger. That number then feeds anything downstream that needs to know how "big" the image is without caring about its exact aspect ratio.

Why this exists

Most resize-related math in a diffusion workflow cares about the longer side, not width and height separately. "Scale this down until the long edge is 1536" or "this image is already at or above my target resolution, skip the upscale step" are both longer-side questions. Rather than pulling width and height separately and doing a max() yourself with a math node, this node hands you the answer directly.

It also doubles as a display node - it's marked as an output node, meaning the resolution shows up right on the node in the UI, so you can glance at the canvas mid-build and see the number without wiring a easy showAnything onto it.

How it works

It reads the image's width and height and returns whichever is larger. Nothing fancier than that - no rounding, no snapping to a step size, just the raw pixel count of the longer dimension.

The inputs and outputs that matter

  • image - the image to measure. The only input.
  • resolution (INT, output) - the length of the longer side, in pixels.

Installing it

Ships with the base pack. ComfyUI Manager: search ComfyUI Easy Use, install, restart. Manually:

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

then install.bat (Windows) or pip install -r requirements.txt, restart. No models needed.

Common issues & troubleshooting

You actually wanted the shorter side. This node only ever gives you the longer one - if your workflow needs to check the short edge instead (say, to decide whether an image is tall or wide, or to cap the smaller dimension), reach for its sibling easy imageSizeBySide, which lets you pick Longest or Shortest explicitly.

Feeding it into a resize node and getting an unexpected aspect ratio. Remember this node only tells you the longer side's length - it says nothing about the shorter side or the ratio between them. If your downstream logic assumes a square or a fixed aspect ratio from this one number alone, that assumption is yours, not the node's; pull width and height separately (or from easy imageSize) if you need both.

Value looks right but nothing downstream reacts to it. Since this is an output node, it's easy to assume wiring the resolution output somewhere is optional because the number is already visible on the canvas. It isn't optional - the on-node display is just a convenience; you still need to connect resolution to whatever should actually use the value (a math node, a comparison, a resize node's target size).

CategoryEasyUse/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
resolutionINT