Nodes/ComfyUI Warper Nodes/Aspect Ratio Match to Standard Resolution (Warper)
ComfyUI Node

Aspect Ratio Match to Standard Resolution (Warper)

Snap any image to 720p or 1080p

By AIWarper·Created about a year ago·Updated 8 months ago· 14
Aspect Ratio Match to Standard Resolution (Warper)
  • image
  • aspect_ratio
  • scaled_width
  • scaled_height
  • ratio_difference
  • original_ratio
standard_resolution720
max_ratio_delta0.050

You've got an input image at an awkward size and you need it to be a real resolution - 720p, 1080p, whatever the pipeline calls for - without destroying the aspect ratio. Aspect Ratio Match to Standard Resolution (Warper) is the node for that: it measures the image, matches its ratio to the nearest standard, and returns the width and height where the shorter edge equals your target. So 16:9 at 720 gives you 1280×720, 9:16 gives you 720×1280, and 1:1 gives you 720×720. Same ratio every time, just a standard-sized footprint.

It's the sibling of Aspect Ratio Match to Base (Warper) in the ComfyUI Warper Nodes pack from workflow author AIWarper. The difference is the sizing rule: Base fixes the height, this one fixes the shorter edge to a standard. Which you want depends on whether you think in "height" or in "this is a 720p job."

How it works

Same detection core as its sibling: it pulls width and height off the tensor, computes the real ratio, and finds the closest of the nine standard ratios (21:9 through 9:21). Within max_ratio_delta you get snapped to a standard; outside it, it labels the output "Custom (W:H)" and keeps your true ratio. Then the sizing rule kicks in: whichever dimension is shorter gets set to standard_resolution, and the longer side is scaled proportionally. Portrait ratios keep their portrait dimensions, landscape keep theirs - nothing rotates, nothing crops. Finally it enforces even numbers on both dimensions, which the Base sibling doesn't bother with; that's a deliberate touch for video work where odd frame sizes cause encoding pain.

Inputs to actually touch:

  • image - source, only its dimensions are read.
  • standard_resolution - target for the shorter edge (default 720; 1080 for 1080p jobs).
  • max_ratio_delta - matching tolerance, default 0.05.

Outputs mirror the Base version: aspect_ratio label, scaled_width, scaled_height, ratio_difference, and original_ratio. Feed the two scale numbers into a resize or latent and you're set.

Installing it

Same as every node in the pack. ComfyUI Manager → search "ComfyUI-WarperNodes" → install → restart, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/AIWarper/ComfyUI-WarperNodes
# restart ComfyUI

No extra pip packages. Only the Flow Visualizer node in this pack needs a model download, and this isn't it.

Common issues

The recurring misunderstanding is that this node resizes images. It doesn't - it's a calculator that outputs dimensions, and you feed those to an actual resize or an Empty Latent. If you keep getting "Custom" labels, your max_ratio_delta is tighter than the image's real ratio, which is correct behavior; loosen it if you wanted hard snapping. And the even-number enforcement can surprise you: the output is occasionally one pixel larger than the pure math would suggest, so if you're comparing against hand-computed sizes, expect the odd ±1. For feeding into a video pipeline, that evenness is the feature, not the bug.

CategoryWarper Tools/Resolution

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
standard_resolutionINT7201–8192
max_ratio_deltaFLOAT0.0500–1

Outputs (5)

NameTypeDescription
aspect_ratioSTRING
scaled_widthINT
scaled_heightINT
ratio_differenceFLOAT
original_ratioFLOAT