Nodes/ComfyUI-nhknodes/🎯 Crop To Mask (nhk)
ComfyUI Node

🎯 Crop To Mask (nhk)

Crop image+mask to mask bbox with uniform padding (great after SAM3)

By EnashkaΒ·Created 11 months agoΒ·Updated about a month agoΒ· 22
🎯 Crop To Mask (nhk)
  • image
  • mask
  • image
  • mask
  • x
  • y
  • width
  • height
β—„padding32β–Ί
β—„mask_threshold0.50β–Ί
β—„divisible_by1β–Ί
Categorynhk/image

Inputs (5)

NameTypeDefaultDescription
imageIMAGEImage to crop (BHWC)
maskMASKMask defining the object bounding box
paddingINT32-2048–4096Pixels added on all sides of the mask bbox. Negative values tighten the crop.
mask_thresholdoptFLOAT0.500–1Pixels with mask value above this count as 'object' when computing the bbox
divisible_byoptINT11–256Round the crop width/height up to a multiple of this value (e.g. 8, 16, 64). 1 = disabled.

Outputs (6)

NameTypeDescription
imageIMAGEβ€”
maskMASKβ€”
xINTβ€”
yINTβ€”
widthINTβ€”
heightINTβ€”