Nodes/ComfyUI-AspectRatioAssigner-LTXV/Aspect Ratio Closest Target
ComfyUI Node

Aspect Ratio Closest Target

Stop hand-picking LTX resolutions — let the source image decide

By mikhailverghese·Created 6 months ago·Updated 6 months ago· 1
Aspect Ratio Closest Target
  • image
  • width
  • height
  • orientation

The pitch

If you've done LTXV image-to-video, you know the drill: Load Image, squint at whether your still is portrait or landscape, then go hunt for the right resolution preset so the latent isn't the wrong shape. Aspect Ratio Closest Target just kills that step. You feed it the source image, it reads the aspect ratio, and it hands back the closest of three LTXV-friendly target sizes. That's the entire job - and honestly, it's the whole job a lot of people re-implement by hand or skip and regret.

Be upfront about what this is: a 20-line utility, not a headline feature. There's no model, no API, no weights to download. It's the kind of node that's either exactly what your workflow was missing or you realize you never needed it. If you build LTXV I2V workflows with a rotating cast of source stills, it earns its keep; if you always use the same canvas, it won't change your life.

How it works

The mechanism is pure ratio math, and you can read all of it in the source file. The node takes the image tensor, pulls out its width and height, then compares the resulting aspect ratio against three fixed buckets:

  • portrait → 768 × 1344
  • landscape → 1344 × 768
  • square → 1344 × 1344

It picks whichever bucket's aspect ratio is closest to your image's and returns that target. Nothing gets resized, cropped, or re-encoded - the node only ever outputs numbers. All three targets are divisible by 32, which matters because LTX is finicky about dimensions and off-grid sizes fail rather than round. The set is a bit of a throwback to the 0.9/13B workflow era, but those sizes are still perfectly valid on the 2B model where this pack is aimed.

The inputs and outputs that matter

Just one input: image (IMAGE) - wire in your Load Image output, nothing else.

Three outputs:

  • width (INT) and height (INT) - the chosen target dimensions. These plug straight into the empty-latent or resolution inputs of your LTX workflow.
  • orientation (STRING) - "portrait", "landscape", or "square". Useful for logging, or for routing into a text node if you want to see what it decided and why.

That's the whole schema. No options to tune, no presets to configure. Either it does what you want with zero fiddling, or it doesn't fit your workflow at all.

Installing it

ComfyUI Manager is the easy route - search the pack title, install, restart. Otherwise:

cd ComfyUI/custom_nodes
git clone https://github.com/mikhailverghese/ComfyUI-AspectRatioAssigner-LTXV.git

Restart ComfyUI after cloning and the node shows up as "Aspect Ratio Closest Target". There are no dependencies, no requirements file, no model downloads - it's a single pure-Python file, so the install is as boring as the node.

Where people get burned

  • It buckets by orientation, not your exact aspect. A 16:9 still maps to landscape (1.78 vs the target's 1.75 - basically a match). But a 4:3 image snaps to square, and when you fill that latent your source is getting cropped. If preserving the source's exact aspect matters, this isn't the node for you - it's a snap-to-grid, not a resize.
  • It outputs integers, not an image. Don't go looking for a preview of the "result." Wire the width/height onward; the work happens downstream.
  • Feed it an image, not a latent or a mask. The input type is IMAGE, and a tensor-shaped mismatch is the usual first error.
  • Era check. If you're running LTX-2.3 with its 1216×704 default or native portrait up to 1080×1920, these fixed 1344 buckets won't match what the modern model wants. This node is aimed at simpler, older LTXV workflows, and that's okay - just know the target before you build around it.

There's no real community footprint here yet, and for a micro-utility that's fine. If you want it, it's one tiny clone away; if you don't, you've now spent two minutes reading about a node you can safely skip.

Categoryutils

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (3)

NameTypeDescription
widthINT
heightINT
orientationSTRING