Nodes/ComfyUI_AIMZ/AIMZ Auto Multiple Unpad
ComfyUI Node

AIMZ Auto Multiple Unpad

The node that undoes the padding you shouldn't have done by hand

By AIMZ-GFX·Created 28 days ago·Updated 17 days ago· 3
AIMZ Auto Multiple Unpad
  • image
  • mask
  • pad_info
  • image
  • mask
left0
right0
top0
bottom0

AIMZ Auto Multiple Unpad is the other half of a two-node workflow, and it only makes sense if you've already met its sibling, AIMZ Auto Multiple Pad. That node pads your image, mask, or frame batch up to a divisible resolution (32 by default), and hands you a pad_info object describing exactly where it added pixels. This node takes that same pad_info, crops everything back to the original dimensions, and you're done. No manual offset bookkeeping.

Why bother with a dedicated unpad node at all? Because the crop math is only trivial the first time you do it. The moment your source resolution changes - you swap in a 768-wide video where you had 720 - every hand-entered offset in your workflow is now wrong, and you will spend an afternoon chasing a 24-pixel shadow on the right edge of your output. Wire pad_info through and the offsets are recomputed automatically every run.

How it works

It crops with simple slicing. If pad_info is connected, it reads the pad_left/pad_right/pad_top/pad_bottom values that the Pad node stored and slices those margins off the image and mask. If pad_info isn't connected, it falls back to the manual left, right, top, bottom integer inputs instead - the escape hatch for when you're unpadding something that came from a different pad node entirely.

The inputs are all optional: image, mask, pad_info, and the four offset ints. The outputs are just image and mask, back at their original sizes. That's the whole node.

The inputs that matter

Honestly, only two of them: connect pad_info (from AIMZ Auto Multiple Pad) and either image or mask. The four manual offset inputs exist for edge cases - unpadding something whose padding you know but whose pad_info you don't have, or a result from a different padding workflow. If you're starting fresh, ignore them.

Like the rest of this pack, it's None-safe: if both image and mask are None, it returns Nones instead of crashing. That matters in the dynamic-branch workflows this pack is designed around, where a slot may legitimately be empty.

Installing it

Same pack, same install. ComfyUI Manager → Custom Nodes Manager → search comfyui_aimz → Install → restart. Or clone directly:

cd ComfyUI/custom_nodes
git clone https://github.com/AIMZ-GFX/ComfyUI_AIMZ.git

No model files, no extra dependencies.

Where people get tripped up

The most common mistake is feeding pad_info from a Pad node that ran on a different batch than the image you're unpadding. The crop offsets come from pad_info, but the crop is applied to whatever image you plug in - so if the image doesn't actually have that padding, you'll crop into real content. Keep the Pad → sample → Unpad chain on one path and you're fine.

Also worth knowing: it's a crop, not a magic restore. If a downstream node resized the padded image, the crop coordinates won't line up anymore. Pad, process at the padded size, unpad - in that order.

CategoryAIMZ/Image

Inputs (7)

NameTypeDefaultDescription
imageoptIMAGE
maskoptMASK
pad_infooptPAD_INFO
leftoptINT00–8192
rightoptINT00–8192
topoptINT00–8192
bottomoptINT00–8192

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK