Nodes/ComfyUI-Inpaint-CropStitch-NB2/SAM 3 Smart Region Selector (FAL API)
ComfyUI Node

SAM 3 Smart Region Selector (FAL API)

SAM 3 Smart Region Selector — SAM 3 with training wheels, in the good way

By amortegui84·Created 5 months ago·Updated 3 months ago· 3
SAM 3 Smart Region Selector (FAL API)
  • image
  • mask
  • mask_image
  • info
  • center_x
  • center_y
  • crop_width
  • crop_height
region_typeobject
custom_text
selection_modelargest
padding_percent0.0
return_rect_maskfalse
api_key
api_key_env_varFAL_KEY
mask_blur_percent0.0
upload_max_dimension2048
return_multiple_maskstrue
max_masks3
include_scorestrue
include_boxestrue
point_prompts_json
box_prompts_json

The bare SAM 3 Image Segmenter makes you type a prompt. This one gives you a dropdown instead - face, upper_body, hair, glasses, hat, shirt, top, bra, pants, skirt, and more, plus a car/vehicle/wheel set - while keeping object available when you need custom text. Same FAL sam-3/image engine underneath, same output contract, just preset-driven.

If you're wondering which of the two SAM nodes to grab: this one. The presets are convenience, sure, but they're also the pack author's curated list of what people actually segment for garment and body retouching - which is this pack's entire specialty. The README's newest garment-detail workflow (08_sam3_garment_detail_seedream45_multistitch.json) uses these preset-driven selectors, and the API variant 09_... does too, so this is the node the pack's own recipes assume.

Inputs and flow

Required: image and region_type (the dropdown, default object). custom_text is required only when you pick object. Everything else mirrors the plain SAM node: selection_mode, padding_percent, return_rect_mask, mask_blur_percent, upload_max_dimension, return_multiple_masks/max_masks, include_scores/include_boxes, the JSON prompt escape hatches, and the api_key/api_key_env_var pair.

Outputs are identical to the Florence and SAM nodes: mask, mask_image, info, center_x, center_y, crop_width, crop_height. Drop-in compatible with Smart Object Isolate Crop, Smart Mask Crop, and NB2 Smart Region.

The depad rule, again

Because it produces SAM masks (exact source resolution, no internal letterboxing), the downstream crop nodes want depad_florence = False. The README calls this out specifically for SAM masks: keep depad_florence = true only for Florence-style masks. Copy the pack's example workflows and you'll see the setting in the right position - that's the easiest way to get it right the first time.

Install & keys

Same pack, same install:

cd ComfyUI/custom_nodes
git clone https://github.com/amortegui84/comfyui-inpaint-cropstitch-nb2

or search comfyui-inpaint-cropstitch-nb2 in ComfyUI Manager, restart. It's a FAL-backed node, so it needs the key - api_key input or FAL_KEY env var, set before launch with a full restart. On the first run you'll know the key is wrong by the 401 Unauthorized from storage/auth/token error; paste the key directly into the node to isolate it, then move to the env var.

Categoryinpaint/api

Inputs (16)

NameTypeDefaultDescription
imageIMAGE
region_typeCOMBOobject19 options: face, upper_body, lower_body, full_body, hair, glasses, +13
custom_textoptSTRING
selection_modeoptCOMBOlargest3 options: largest, first, merge_all
padding_percentoptFLOAT0.00–100
return_rect_maskoptBOOLEANfalse
api_keyoptSTRING
api_key_env_varoptSTRINGFAL_KEY
mask_blur_percentoptFLOAT0.00–100Soft blur applied to the returned SAM mask.
upload_max_dimensionoptINT2048512–4096
return_multiple_masksoptBOOLEANtrue
max_masksoptINT31–32
include_scoresoptBOOLEANtrue
include_boxesoptBOOLEANtrue
point_prompts_jsonoptSTRING
box_prompts_jsonoptSTRING

Outputs (7)

NameTypeDescription
maskMASK
mask_imageIMAGE
infoSTRING
center_xINT
center_yINT
crop_widthINT
crop_heightINT