ComfyUI Node

AP Mask Trim

Trims a mask region by percentage along the X and/or Y axis. crop_x: Positive value → trim that percentage from the RIGHT edge. Negative value → trim from the LEFT edge. Example: 30 removes the rightmost 30 % of the mask. crop_y: Positive value → trim from the BOTTOM. Negative value → trim from the TOP. Example: -40 removes the top 40 % of the mask. auto_align: When True, trim axes rotate to match the mask's principal orientation (PCA major/minor axes of the masked region). crop_y then always trims the 'bottom' of the masked shape, regardless of how it is rotated in the image — useful for tilted heads, diagonal limbs, etc. feather: Soft-edge width in pixels at the cut boundary. 0 = hard cut. mask_dilate: Expands the trimmed mask by this many pixels (morphological dilation). mask_blur: Gaussian blur applied to the final mask after trimming and dilation.

By adampolczynski·Created 5 months ago·Updated 5 months ago· 1
AP Mask Trim
  • mask
  • mask
crop_x0
crop_y0
auto_alignfalse
feather10
mask_dilate0
mask_blur0
CategoryAP ClipSEG Light

Inputs (7)

NameTypeDefaultDescription
maskMASK
crop_xINT0-100–100Trim % from right (positive) or left (negative). 0 = no trim.
crop_yINT0-100–100Trim % from bottom (positive) or top (negative). 0 = no trim.
auto_alignBOOLEANfalseWhen True, trim axes follow the mask's principal orientation (PCA). crop_y trims the 'bottom' of the masked shape even when it is rotated.
featherINT100–200Soft-edge width in pixels at the cut boundary.
mask_dilateINT00–64Dilate (expand) the trimmed mask by this many pixels.
mask_blurINT00–64Gaussian blur applied to the final mask.

Outputs (1)

NameTypeDescription
maskMASK