ComfyUI Node

Mask Align

Slides a painted area so it lines up with a reference mask, or with the frame when none is given. Each axis picks its own anchor: center centres the paint inside the reference, left/top glues the two near edges together, right/bottom lines the two far edges up, none leaves that axis alone. output aligned moves the paint itself, soft edges and all; output bbox draws the solid rectangle it occupies, and union_bbox extends that rectangle to cover the reference too. A whole batch moves by one shared offset so video frames stay registered.

By live1617·Created 21 days ago·Updated 2 days ago· 3
Mask Align
  • mask
  • reference
  • mask
◄align_xcenter►
◄align_ycenter►
◄outputaligned►
◄union_bboxfalse►
CategoryQG-tools/Mask

Inputs (6)

NameTypeDefaultDescription
maskMASKThe mask to move. Every frame moves by the same offset.
align_xCOMBOcenterHorizontal anchor. none leaves x alone.
align_yCOMBOcenterVertical anchor. none leaves y alone.
outputCOMBOalignedaligned: the paint, moved. bbox: a solid rectangle covering where it landed.
union_bboxBOOLEANfalsebbox only: stretch the rectangle to cover the reference's too. No effect without a reference.
referenceoptMASKWhat to line up against. Anything not fully transparent counts, whatever its brightness. Empty means the frame itself.

Outputs (1)

NameTypeDescription
maskMASKThe moved mask, same size as the one handed in.