Nodes/was-node-suite-comfyui/Image Aspect Ratio
ComfyUI Node Runs on cloud

Image Aspect Ratio

Read a picture's shape and branch a workflow on it

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Image Aspect Ratio

      This node doesn't change your image - it measures it. Feed it a picture and it tells you the aspect ratio three ways: as a raw float, as a human-readable common format like 16:9, and as a plain label for whether the thing is portrait, landscape, or square. The WAS README lists exactly that trio. It's a read-only inspector, and it's more useful than it sounds the moment you're building anything that has to handle images of unknown shape.

      The reason you'd want it: automation. If you're batch-processing a folder where some images are tall, some wide, some square, you can't hardcode one set of dimensions. Image Aspect Ratio lets the workflow see the shape and react - pick a target resolution, choose a crop strategy, route portraits down one branch and landscapes down another.

      How it works

      It divides width by height and reports that number, then also translates it into the nearest tidy ratio string and a category. The portrait/landscape/square label is just the sign of that comparison made friendly: taller than wide is portrait, wider than tall is landscape, equal is square. Nothing mysterious - it's doing the arithmetic you'd do in your head, but as data your other nodes can consume.

      The inputs and outputs that matter

      • The image in - the picture whose shape you want to know.
      • A float ratio out - the exact width/height number, handy for feeding into math or comparison nodes.
      • A common-format string out - the readable 16:9-style label.
      • An orientation out - portrait, landscape, or square, which is the one you'll usually branch on.

      I'm naming these from the README's own description of what it returns, not from a formal schema, so treat them as the shape of the outputs rather than exact port labels. The interesting move is wiring the float or the orientation into a switch or a condition node so the rest of the graph adapts automatically.

      How to install it

      Comes with the WAS Node Suite:

      • ComfyUI Manager: search was-node-suite-comfyui, install, restart.
      • Manually: cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, then pip install -r requirements.txt against your ComfyUI Python, and restart.

      It's a pure measurement node - no model, no heavy dependency. The suite's chunky downloads only load for the nodes that use them.

      Common issues

      The main thing to keep in mind is that a float ratio and a "common format" don't always agree cleanly. A photo at 1.775 isn't exactly 16:9 (which is 1.777…), so the common-format output snaps to the nearest recognizable ratio while the float stays precise. If you're making decisions, branch on the float or the orientation label, not on string-matching the common format - otherwise an oddball resolution that rounds to an unfamiliar ratio can slip through your logic.

      There's no output image here, so if you wired this expecting a processed picture, that's the confusion - it's an analyzer, full stop. Send the original image around it to whatever does the actual work.

      And the pack-wide caveat holds: WAS Node Suite has been retired since December 2023, still widely used but unmaintained, so a ComfyUI update can make every WAS node vanish with an "Import Failed." That's suite-wide dependency drift, not this node - re-run requirements.txt against the correct Python environment (or the bundled install.bat) and restart.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs