LTX-2 Pad Reflect (IMAGE batch)
Pad a frame batch up to LTX-2's grid with edges that don't look fake
- images
- images
- pad_x
- pad_y
- report
LTX-2 needs frame dimensions on a specific grid, and real source footage - a clip you've sliced out of a longer video, the last 9 frames of a previous generation segment - almost never lands there on its own. When it's a few pixels short, you have two options: resize the whole frame (distorts it) or pad it. This node pads, and it pads in a way that doesn't announce itself.
The reason it's called "Pad Reflect" is the default behavior: instead of filling the new border with a solid color or by repeating the edge pixel, it mirrors the frame's contents across the boundary. Reflect padding keeps gradients and textures flowing, which matters more than you'd think when the padded result is going to be VAE-encoded. Solid-black borders can show up as a hard seam in the latent; reflected pixels mostly just look like the image continuing.
How it works
Pure F.pad on the [B,C,H,W] tensor, pad_x pixels on left+right and pad_y on top+bottom, then back to [B,H,W,C]:
x = _F.pad(x, (px, px, py, py), mode=mode)
Two modes, both real PyTorch pad modes: reflect (mirror, no edge pixel repeated) and replicate (edge pixel stretched out). The one thing to know: reflect mode requires the pad to be smaller than the dimension, so the node clamps your request to w - 1 / h - 1 rather than erroring. The outputs tell you the truth - pad_x and pad_y come back as the actually applied values, not what you asked for.
Inputs and outputs
images- the IMAGE batch to pad.pad_x,pad_y- pixels to add per side (0–512, default 16).pad_mode-reflect(default) orreplicate.
Outputs: images (padded batch), pad_x / pad_y (the effective pad, handy to feed forward so later nodes know the true size), and a report STRING describing the transform.
Install
Part of IAMCCS-nodes, so either ComfyUI Manager → search "IAMCCS", or:
cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git
Restart and you're done - this one has no dependencies beyond torch and ComfyUI core.
Gotchas
Pair it with IAMCCS_LTX2_ImageBatchCropByPad and you have a complete pad-up / crop-down toolkit for grid alignment. The honest failure mode is mild: if you ask for more pad than the mode allows, you get the clamp behavior from above instead of an error, so read the report if your dimensions look off. And remember LTX-2's rule of thumb - the pack's own validator treats 16px as the safe spatial multiple - so padding to that boundary before the VAE is the whole game here.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| pad_x | INT | 160–512 | — |
| pad_y | INT | 160–512 | — |
| pad_mode | COMBO | reflect | 2 options: reflect, replicate |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| pad_x | INT | — |
| pad_y | INT | — |
| report | STRING | — |