Nodes/Yaser-nodes for ComfyUI/๐Ÿ“ ImageSize (Side) - Yaser
ComfyUI Node

๐Ÿ“ ImageSize (Side) - Yaser

How big is this image, actually? The one-number answer.

By YaserJaradehยทCreated about a year agoยทUpdated 11 months agoยท 8
๐Ÿ“ ImageSize (Side) - Yaser
  • image
  • resolution
โ—„sideโ–พโ–บ

If you've ever squinted at a (1, 1024, 1536, 3) shape and asked "wait, which one is width?", this node is for you. ImageSize (Side) - Yaser takes an image and hands back a single integer: the length of its longest or shortest side. That's the entire job. It's a tiny node with one genuinely useful purpose.

Why would you want that number? Because the longest side is the number that decides whether an upscale pass is going to OOM you, and it's the number you plug into anything that needs to know "how big is my canvas" before it does math on it. A common pattern: load an image, read its longest side, and use it to compute the target resolution for a latent or an upscale scale that stays inside your VRAM budget. See how big you're working before you commit the GPU.

How it works

Feed it an image (a standard ComfyUI IMAGE tensor), pick side from the dropdown - Longest or Shortest - and it compares height against width, then returns the winner. Internally it's a port of imageSizeBySide from ComfyUI-Easy-Use, so if you've used that pack before, this will feel familiar. There's no sampling, no model, no magic: one comparison, one integer out.

The output is named resolution and it's an INT. Wire it into whatever needs a dimension: an empty latent's width/height, a crop, an upscale scale calculator. The node is also flagged as an output node (OUTPUT_NODE = True), which means it can display the value on the canvas - handy when you're debugging why your 8K image just ate 12 GB of VRAM and you need to see the actual number instead of reading tensor shapes in the console.

The two inputs you'll touch

  • image - the IMAGE you want to measure. That's it.
  • side - Longest or Shortest. Longest is the one you'll use 95% of the time.

There's no width/height pair output like some size nodes give you - if you need both dimensions separately, this isn't the node for you. But when you only care about one number (and with the upscaling and tiled VAE nodes in this same pack, one number is usually all you need), it's the cleanest way to get it.

Install

Same pack as everything else from YaserJaradeh:

cd ComfyUI/custom_nodes
git clone https://github.com/YaserJaradeh/comfyui-yaser-nodes.git

restart ComfyUI, or install via ComfyUI Manager by searching "Yaser-nodes". No models, no extra dependencies.

Things worth knowing

  • It measures a single image's dimensions, so if you feed it a batch where frames differ in size, it reads from the batch tensor's shape - which is uniform in ComfyUI anyway.
  • There's nothing to tune. If you need to know the biggest side of a batch, or you're deciding between "longest" and "shortest" to pick an upscale factor, this is the fastest way to get the number without a calculator and a screenshot.

It won't change your life, but when you need a dimension and you're mid-workflow, it saves you the trip to the console.

CategoryYaser/Image

Inputs (2)

NameTypeDefaultDescription
imageIMAGEโ€”
sideCOMBO2 options: Longest, Shortest

Outputs (1)

NameTypeDescription
resolutionINTโ€”