EBU Get Image Aspect Ratio
The one-string aspect ratio answer
- image
- aspect_ratio
EBU Get Image Aspect Ratio is the plainest node in the EBU Workflow pack: image in, one string out. You hand it any image and it tells you the closest standard aspect ratio - "4:3", "16:9", "9:16", that sort of thing - or "Unknown" if nothing fits.
That's it. No extra outputs, no knobs. Which makes this node the one you reach for when you want a quick label, not a calculation.
What it does, precisely
It looks at the first image in the batch, computes width divided by height, and matches that number against a hardcoded list of fourteen common ratios - the landscape staples (16:9, 16:10, 3:2, 4:3, 5:4, 6:5, 2:1, 1:1) and their portrait counterparts (9:16, 10:16, 2:3, 3:4, 4:5, 5:6). The tolerance is fixed at 8%: if the closest match is within that, you get the label; otherwise you get "Unknown".
It's worth knowing this is the stripped-down sibling. The pack also ships EBU Get Image Aspect Ratio From Image, which adds a configurable tolerance, a delimiter, and - the useful part - actual width/height integer outputs and a resolution string. If you're building anything automated, use that one. This one is for when you just need to see the answer, or you're feeding a label into something that only cares about the category.
Outputs and wiring
One output: aspect_ratio (STRING). Wire it into a Show Text node to see it, or into a switch/condition that picks a path based on orientation. A common trick is chaining it with the pack's EBU Scaling Resolution: read the ratio, then pick a matching resolution preset from the scaling node by hand. It's not a hard link - this node won't drive that one automatically - but it tells you which preset to reach for.
Installing
Same story as the rest of the EBU Workflow pack: no dependencies beyond Python's standard library, no model files to fetch. ComfyUI Manager (search "EBU Workflow"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/burnsbert/ComfyUI-EBU-Workflow
then restart ComfyUI.
Notes and gotchas
- The 8% tolerance is baked in. A 1.6:1 image lands in 16:10 (1.6) even though it's also close to 3:2 (1.5) - it picks the mathematically nearest bucket, not the "intended" one.
- Batches: only the first frame is measured. Feeding it a multi-image batch gives you one ratio, not one per image.
- Oddly sized or heavily cropped images will happily return
"Unknown", which is honest - that's the node declining to guess rather than lying to your workflow. - The node prints a DEBUG line to the console on every run (dimensions, ratio, closest match). Harmless, mildly chatty.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| aspect_ratio | STRING | — |