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)
Name
Type
Default
Description
mask
MASK
—
crop_x
INT
0-100–100
Trim % from right (positive) or left (negative). 0 = no trim.
crop_y
INT
0-100–100
Trim % from bottom (positive) or top (negative). 0 = no trim.
auto_align
BOOLEAN
false
When True, trim axes follow the mask's principal orientation (PCA).
crop_y trims the 'bottom' of the masked shape even when it is rotated.
feather
INT
100–200
Soft-edge width in pixels at the cut boundary.
mask_dilate
INT
00–64
Dilate (expand) the trimmed mask by this many pixels.