Nodes/Anymatix/Anymatix LTX Resize To Closest Valid Size
ComfyUI Node

Anymatix LTX Resize To Closest Valid Size

LTX won't run your canvas unless it's a multiple of 64 — this node fixes that for you

By Anymatix·Created about a year ago·Updated 2 days ago· 0
Anymatix LTX Resize To Closest Valid Size
  • image
  • image
target_height720
max_longer_edge1920

LTX won't touch a canvas whose dimensions aren't clean multiples of 32, and it bites hardest in the two-pass image-to-video flows people actually run. If you've ever fed a 1302×732 image into an LTX sampler and watched it either fail or silently crop, this node is the fix - it's the resize step that makes the numbers come out right so you don't have to do arithmetic on a calculator in your head.

The node exists because of how LTX video models are built: their latent space works on a strict grid (32px in the model itself), and the Anymatix workflows it ships in use a half-resolution base pass that's later upscaled 2×. For that doubling to land back on a valid canvas, the half-res size needs to be a multiple of 64 - so when you double it, you get a multiple of 32 on the other side. The node's docstring says it plainly: this is a helper for the LTX 2.3 two-pass I2V pattern, and it snaps everything to 64px multiples. AnymatixLTXResizeToClosestValidSize isn't a sampler or an encoder - it's the unglamorous geometry guardrail in front of them.

What it actually does

You give it an image and two numbers, and it returns a resized image:

  • image - whatever frame or still you're about to feed the video workflow.
  • target_height (default 720) - the height you want the canvas to be, roughly. The node preserves the source aspect ratio and scales so height lands near this.
  • max_longer_edge (default 1920) - the ceiling. If your aspect ratio would push the longer side past this, it scales down to fit instead. Set this to the longest dimension your GPU can actually sample at.

It resizes with Lanczos, keeps the aspect ratio, and then snaps the result to the closest multiple of 64 (a _snap_to_multiple with rounding, plus a _snap_down_to_multiple so the capped edge never sneaks past your max_longer_edge). The output is a plain IMAGE, so it plugs straight into whatever comes next - usually a VAE encode into the LTX latent pipeline, or straight into the sampler.

One output, one type: image (IMAGE). That's the whole contract.

Why you'd reach for it instead of a plain image resize

Any Resize node can make an image the right number of pixels. This one makes an image the right number of pixels and a valid LTX canvas, in one step, with the 64px snapping handled. The trap it saves you from is the off-by-a-few-pixels canvas: you resize "to 720p", LTX silently complains or crops, and you burn ten minutes wondering whether it's your sampler settings. A stock ComfyUI install doesn't have this node - it's part of the Anymatix pack, so it shows up alongside the LTX workflows that need it.

Installing it

Anymatix ships this in anymatix-comfy-nodes (it's the pack the Anymatix desktop app runs on, but you don't need the app - the README is explicit that you don't). In ComfyUI Manager, search "anymatix-comfy-nodes" and install, then restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Anymatix/anymatix-comfy-nodes

then restart ComfyUI. The node lives under the "Anymatix" category in the node menu.

Troubleshooting

The usual failure is scope, not the node: if you've set target_height and max_longer_edge in conflict - say a target of 720 with a max longer edge of 512 - the cap wins, and the output will be smaller than you asked for. That's the intended behaviour, not a bug; the max_longer_edge is the hard budget. If your still comes back stretched or squashed, you fed the node an image with a weird aspect ratio and the Lanczos pass preserved it - check the source dimensions before blaming the snap.

CategoryAnymatix

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
target_heightINT72064–16384
max_longer_edgeINT192064–16384

Outputs (1)

NameTypeDescription
imageIMAGE