Popo Image Aspect Ratio
9 or 9:16 without doing division in your head
- image
- aspect_ratio
- ratio_name
Aspect ratio is one of those things you compute a hundred times in ComfyUI but never want to compute yourself. Popo Image Aspect Ratio does it in one node: IMAGE in, and out come two values - aspect_ratio (a FLOAT) and ratio_name (a STRING). If you've ever eyeballed a generated image and wondered "is that actually 16:9 or is it 1.74 and I'm fooling myself?", this is the node that settles it with a number and a label.
It's one of the four nodes in ComfyUI Popo Utility. Nothing here is exotic - that's the point. It's a small, opinionated convenience so you can branch on aspect ratio without building the division yourself.
How it works
Same zero-copy trick as the pack's other image nodes: it reads the tensor's shape (no pixel data touched) and computes aspect_ratio = width / height, rounded to three decimals. Then it runs the result against a small lookup table - 1:1, 4:3, 3:2, 16:9, 21:9, 5:4, and their portrait mirror images (3:4, 2:3, 9:16) - and returns the matching label like 16:9 Widescreen or 9:16 Portrait Widescreen. Matching has a 5% tolerance, so 1.78 (true 16:9 is 1.777…) correctly lands on "16:9 Widescreen." If nothing fits, it falls back to a generic X.XX:1 Landscape or 1:X.XX Portrait. Note the convention: the ratio is width-over-height, so > 1 is landscape and < 1 is portrait.
What you'd wire it into
The ratio_name string is for your eyes - handy for labeling or a display node, but it's not something you want to branch on (string comparisons in a graph get ugly fast). For actual logic, use the aspect_ratio FLOAT: feed it into a switch or condition to route landscape images one way and portrait the other, e.g. different upscale targets per orientation. A common pattern is chaining it after Popo Image Dimensions - that node gives you the raw sizes, this one gives you the interpretation.
Install
No model downloads, no extra dependencies beyond the torch/numpy/Pillow ComfyUI already has.
cd ComfyUI/custom_nodes
git clone https://github.com/popoimm/comfyui-popo-utility
Restart, then Add Node → popo-utility → Popo Image Aspect Ratio, or search "aspect ratio" / "popo." ComfyUI Manager users can search "ComfyUI Popo Utility."
Common issues and gotchas
The 5% tolerance is the thing that surprises people: a crop at 1.9 isn't named "ultrawide" because it's 7% off from 21:9, so it falls through to the generic landscape string. That's by design, just don't expect exotic ratios to get names. And if you see invalid or 0.0, the input wasn't a recognized 3D/4D image tensor. Restart-not-visible is the other classic with this pack - if the node's missing after install, restart; the console should print Popo Utility v1.0.1 - Simple version loaded!.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| aspect_ratio | FLOAT | — |
| ratio_name | STRING | — |