Nodes/ComfyUI Popo Utility/Popo Image Dimensions
ComfyUI Node

Popo Image Dimensions

Width, height, long side, short side

By popoimm·Created about a year ago·Updated about a year ago· 0
Popo Image Dimensions
  • image
  • width
  • height
  • long_side
  • short_side

If you need to know what an image is, size-wise, this is the node to grab. Popo Image Dimensions takes one IMAGE in and hands you four INTs out: width, height, long_side, and short_side. That makes it a strict superset of the pack's own Popo Image Size (which only returns long/short), so if you're only installing one dimension node from ComfyUI Popo Utility, make it this one. Same single input, no options to configure, no hidden gotchas in the UI - there isn't a UI, just the wire.

How it works

Identical trick to its siblings: it reads the tensor's shape rather than decoding pixels. For a [batch, height, width, channels] tensor it takes height and width from positions 1 and 2, then derives long_side = max(h, w) and short_side = min(h, w). Zero data copying, effectively zero time. This is why these nodes feel instant even on giant images - they're not looking at the image at all, just its metadata.

What you'd do with it

The four outputs cover the two ways people think about image size. width/height are the exact pixel counts, the ones you want for layout math, conditioning on resolution, or comparing against a model's native resolution - that's where the "resolution wrong" troubleshooting instinct lives. long_side/short_side are the orientation-agnostic versions, handy when you don't care whether it's portrait or landscape, just "how big is this thing." Wire the INTs into a scale node, a switch, a condition, or a math node like this pack's Popo Math Expression - a * 0.75 on width gives you a 75% target.

Reading the numbers right

The numbers it reports are the dimensions of the tensor as it reaches this node, not the original file's resolution. If an upscale or resize node sits upstream, you get the post-resize size. That's usually exactly what you want (you're computing on what you actually have), but it does mean the node is only as truthful as the node before it.

Install

No model files, no requirements beyond what ComfyUI already ships (torch, numpy, Pillow).

cd ComfyUI/custom_nodes
git clone https://github.com/popoimm/comfyui-popo-utility

Restart ComfyUI and it's under Add Node → popo-utility → Popo Image Dimensions. Via ComfyUI Manager, search "ComfyUI Popo Utility."

Common issues and gotchas

The usual one: node not visible after install means the process wasn't restarted - a clean start prints Popo Utility v1.0.1 - Simple version loaded! to the console, and no print means no node. A stream of zeros means the input wasn't a 3D/4D image tensor. And if you're also reaching for the aspect-ratio node for the same image, you can skip it when you have this one - width ÷ height is the ratio.

Categorypopo-utility

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (4)

NameTypeDescription
widthINT
heightINT
long_sideINT
short_sideINT