Nodes/RulZnodes/RulZ Mask Intelligent Crop
ComfyUI Node

RulZ Mask Intelligent Crop

Crop an image and/or mask to the mask's bounding box, extended on every side by a percentage of the crop, mask or image size: one value for all sides or one per edge. Both inputs are optional.

By speedyrulz·Created about a month ago·Updated a day ago· 1
RulZ Mask Intelligent Crop
  • image
  • mask
  • image
  • mask
◄padding_modeuniform►
◄padding_percent10.0►
◄padding_top10.0►
◄padding_bottom10.0►
◄padding_left10.0►
◄padding_right10.0►
◄padding_referencecrop►
◄aspect_limit2:3 / 3:2►
◄divisible_by1►
◄mask_threshold0.00►
CategoryRulZnodes

Inputs (12)

NameTypeDefaultDescription
padding_modeCOMBOuniformuniform: padding_percent is used on every side. per_edge: padding_top, padding_bottom, padding_left and padding_right set each side separately.
padding_percentFLOAT10.00–100uniform mode: how far each side extends beyond the masked area, as a percentage of the padding_reference size (width for left/right, height for top/bottom).
padding_topFLOAT10.00–100per_edge mode: how far the top side extends beyond the masked area, as a percentage of the padding_reference height.
padding_bottomFLOAT10.00–100per_edge mode: how far the bottom side extends beyond the masked area, as a percentage of the padding_reference height.
padding_leftFLOAT10.00–100per_edge mode: how far the left side extends beyond the masked area, as a percentage of the padding_reference width.
padding_rightFLOAT10.00–100per_edge mode: how far the right side extends beyond the masked area, as a percentage of the padding_reference width.
padding_referenceCOMBOcropcrop: percentage of the final cropped image, so the subject sits inside a border of that size. mask: percentage of the mask bounding box. image: percentage of the full input image.
aspect_limitCOMBO2:3 / 3:2Never crop more elongated than this ratio. A crop that would be taller than 2:3 is widened, one wider than 3:2 is heightened. The crop is only ever grown, never shrunk.
divisible_byINT11–1024Grow the crop so its width and height are multiples of this value. 1 disables it.
mask_thresholdFLOAT0.000–1Mask pixels above this value count as masked.
imageoptIMAGE—
maskoptMASK—

Outputs (2)

NameTypeDescription
imageIMAGE—
maskMASK—