Aspect Ratio Match to Base (Warper)
Turn 'some image' into a clean 720p-sized frame
- image
- aspect_ratio
- scaled_width
- scaled_height
- ratio_difference
- original_ratio
When you drag an input image into a video or image workflow, it comes in whatever size it came in - 1024×572, 731×913, a banana's aspect ratio. Downstream, samplers and video models want something clean, and the "fix it" node in your graph usually needs to know what ratio you're actually working with. Aspect Ratio Match to Base (Warper) measures the image, matches its aspect ratio to the nearest standard (16:9, 4:3, 1:1, and friends), and tells you the dimensions that ratio implies at whatever base height you set. It's the "figure out what this image is, roughly, and what a clean version of it would be" node.
It's from ComfyUI Warper Nodes, the niche pack by workflow author AIWarper, and it's pure measurement - no model, no resizing, no downloads. It hands you numbers; you hand them to a resize or a latent. There's a sibling, Aspect Ratio Match to Standard Resolution (Warper), that does the same detection but sizes the shorter edge to a standard instead of assuming a base height.
How it works
It reads the width and height straight off the image tensor's shape and computes original_ratio. Then it scans a fixed list of nine common ratios (21:9 through 9:21), finds the closest one, and checks the gap against max_ratio_delta. If the image is close enough to a standard ratio, you get that ratio's label plus a width scaled to your base_height (so 16:9 at base 720 gives you 1280×720). If the image is too weird to fit - say 5:4, which is over the default 0.05 tolerance from everything - it falls back to a "Custom (5:4)" label and scales your true ratio to that height instead. Either way the math is exact, so scaled_width and scaled_height are real numbers to feed a resize, not suggestions.
Inputs that matter:
image- anything with an IMAGE type; only its dimensions are used.base_height- the height you want your scaled frame to be (default 720).max_ratio_delta- how picky the matching is. Default 0.05 tolerates small rounding; raise it to force everything into a standard bucket, lower it to stay honest.
Outputs: aspect_ratio (a label like "16:9" or "Custom (5:4)"), scaled_width, scaled_height, ratio_difference (how far the image actually was from its matched ratio), and original_ratio (the true width/height). The first three are the ones you'll wire out.
Installing it
Standard Warper install: ComfyUI Manager → search "ComfyUI-WarperNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIWarper/ComfyUI-WarperNodes
# restart ComfyUI
Zero extra dependencies - this node is shape math on a tensor. The RAFT model in the README is only for Flow Visualizer.
Common issues
The two traps here are conceptual, not technical. First, this node does not resize your image - beginners wire the IMAGE output expecting a scaled image and find nothing. There is no image output. Use the numbers. Second, understand base_height vs the standard-resolution sibling: base sets the height and derives width, so it's ideal for latents where you control the vertical. If you set base_height to 1080 on a portrait 9:16 image, you get 608×1080 - a perfectly scaled frame, just not one any standard preset will recognize. And if max_ratio_delta is too tight, everything reports as "Custom," which is accurate but unhelpful when you actually wanted snapping.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| base_height | INT | 7201–8192 | — |
| max_ratio_delta | FLOAT | 0.0500–1 | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| aspect_ratio | STRING | — |
| scaled_width | INT | — |
| scaled_height | INT | — |
| ratio_difference | FLOAT | — |
| original_ratio | FLOAT | — |