Nodes/ComfyUI-Kling-Direct/Kling Aspect Ratio Picker
ComfyUI Node

Kling Aspect Ratio Picker

The Tiny Node That Stops Kling From Stretching Your Image

By IxMxAMAR·Created 5 months ago·Updated 2 months ago· 4
Kling Aspect Ratio Picker
  • image
  • aspect_ratio
  • info

Kling Aspect Ratio Picker is the pack's quietest useful node: it looks at an image and tells you which of Kling's seven aspect ratios is closest to it. That's the whole job. No API call, no credits, no auth input - it's pure local math. You'll reach for it when you feed an image into Kling Image-to-Video and the output comes back with a different shape than your input, which is one of those "why is my video 16:9 when my image was portrait?" moments.

Kling only accepts a fixed set of ratios - 16:9, 9:16, 1:1, 3:2, 2:3, 4:3, 3:4 - and it doesn't silently letterbox to preserve your composition. Pick the wrong one and the model stretches or crops your source. This node removes the guesswork.

How it works

The mechanism is exactly what you'd hope: it takes the first frame of your IMAGE input, computes width ÷ height, and picks the closest of the seven valid ratios. It's the same math you'd do by hand, done once and correctly.

Outputs:

  • aspect_ratio - a STRING like "16:9" or "3:4", and conveniently it's a widget, so when you wire it into a Kling node's aspect_ratio field it shows as text you can read at a glance.
  • info - a human-readable string telling you the source pixel dimensions, the exact computed ratio, and which ratio it chose (e.g. 1080x1350 ratio=0.800 -> 3:4 (0.750)). Leave it unwired; it exists for when you want to sanity-check the decision.

Where it shines

The natural home is an Image-to-Video pipeline where the input image comes from somewhere you don't control - a loaded photo, a prior node's output, an arbitrary batch. Wire the picker's aspect_ratio into the aspect_ratio (or in some flows, into ImageGen before you even get to video) and your output shape stays consistent with your source. It's also handy for the Image Extend node: tell Kling the target ratio and it outpaints toward it, and the picker tells you which direction that should be for your source.

One honest caveat: it picks the closest ratio, not a guaranteed match. A 4:3-ish source that's actually 1.37:1 will snap to 4:3 because that's all Kling offers - there's no way around it, the API is the limit. And the info string only reflects the first frame of a batch, so if you feed it a video with per-frame aspect changes, it's reasoning about frame zero.

When you don't need it

If you always generate your source images in one of Kling's native ratios (which you will if you generated them with the pack's own Image Generation node), the picker is redundant - you already know the ratio. It earns its place when inputs arrive from outside. It's also a nice teaching node: wire it up once, read the info string, and you'll actually learn what aspect ratios your images have.

Install

It ships with the pack, so there's nothing extra to fetch:

cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-Kling-Direct

or search "Kling Direct" in ComfyUI Manager and install. No models, no dependencies beyond what ComfyUI ships. It's one of those config nodes you'll forget exists until the day it saves you a stretched-face render.

CategoryKling AI/Config

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (2)

NameTypeDescription
aspect_ratio16:9,9:16,1:1,3:2,2:3,4:3,3:4
infoSTRING