ComfyUI Node

NB2 Smart Region

Fits a rectangular NB2 crop around a semantic region mask. Use this after a Florence/SAM-style selector when you want to keep the existing NB2 Crop and NB2 Stitch workflow.

By amortegui84·Created 4 months ago·Updated 2 months ago· 3
NB2 Smart Region
  • image
  • region_mask
  • mask
  • nb2_width
  • nb2_height
  • preview_image
  • center_x
  • center_y
  • crop_width
  • crop_height
  • info
aspect_ratioauto
resolution2K
padding_percent8.0
crop_scale1.00
depad_florencetrue
region_info
Categoryinpaint/nb2

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
region_maskMASK
aspect_ratioCOMBOauto4 options: auto, 16:9, 9:16, 1:1
resolutionCOMBO2K3 options: 1K, 2K, 4K
padding_percentFLOAT8.00–100Expands the detected region before rectangle fitting.
crop_scaleFLOAT1.001–4Additional scale multiplier applied after aspect-ratio fitting.
depad_florenceBOOLEANtrueRemove Florence2's internal square letterbox padding before resizing the mask. Keep True when the mask comes from Florence2Run (kijai). Disable only if your mask is already at the exact source image resolution.
region_infooptSTRING

Outputs (9)

NameTypeDescription
maskMASK
nb2_widthINT
nb2_heightINT
preview_imageIMAGE
center_xINT
center_yINT
crop_widthINT
crop_heightINT
infoSTRING