ComfyUI Node

NB2 Mask Generator

Creates a positioned rectangle mask matching Nano Banana 2 aspect ratios. Connect mask → InpaintCropNB2, nb2_width/nb2_height → NB2 Crop inputs, and preview_image → any Preview Image node to see the crop position annotated on the original.

By amortegui84·Created 5 months ago·Updated 2 months ago· 3
NB2 Mask Generator
  • image
  • mask
  • nb2_width
  • nb2_height
  • preview_image
aspect_ratio16:9
resolution2K
center_x512
center_y512
crop_width960
Categoryinpaint/nb2

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
aspect_ratioCOMBO16:93 options: 16:9, 9:16, 1:1
resolutionCOMBO2K3 options: 1K, 2K, 4K
center_xINT5120–16384Horizontal centre of the crop rectangle in pixels.
center_yINT5120–16384Vertical centre of the crop rectangle in pixels.
crop_widthINT96064–16384Width of the crop region on the original image in pixels. Height is auto-calculated from the aspect ratio. Clamped if larger than the image.

Outputs (4)

NameTypeDescription
maskMASK
nb2_widthINT
nb2_heightINT
preview_imageIMAGE