SAM 3 Image Segmenter (FAL API)
SAM 3 Image Segmenter — 'garment' and nothing else comes back
- image
- mask
- mask_image
- info
- center_x
- center_y
- crop_width
- crop_height
Florence-2 knows region categories. SAM 3 knows how to segment whatever you name. This node is the second one: it sends your image to FAL's fal-ai/sam-3/image endpoint with a text prompt - default garment - and gets back a clean semantic mask of that thing, ready to drive the pack's crop and stitch nodes.
Where it shines is object-level isolation for garment detail passes. The README's recommended flow puts it in front of Smart Object Isolate Crop:
SAM 3 "bra" -> Smart Object Isolate Crop -> Seedream 4.5 Edit \
SAM 3 "pants" -> Smart Object Isolate Crop -> Seedream 4.5 Edit -> Smart Mask Multi Stitch -> final
And because it shares the exact same output contract as the Florence selector - mask, mask_image, info, center_x, center_y, crop_width, crop_height - you can swap one for the other without rewiring anything downstream. That's deliberate, and it's the most useful property of this node.
Inputs
Required: image and prompt (the thing to segment - "bra", "pants", "glasses", "wheel", anything). Then:
selection_mode-largest(default),first, ormerge_allwhen SAM returns multiple masks.return_multiple_masks+max_masks(up to 32) - ask SAM for several candidates and pick; useful when the model keeps grabbing a whole outfit when you wanted one piece.include_scores/include_boxes- on by default; they give you confidence scores and boxes in theinfopayload.point_prompts_json/box_prompts_json- raw SAM point/box prompts as JSON lists, for when a text prompt isn't precise enough. This is the power-user escape hatch; most people never touch it.padding_percent,return_rect_mask,mask_blur_percent,upload_max_dimension, and theapi_key/api_key_env_varpair - same as the Florence selector.
The one thing to remember
SAM masks are already at exact source resolution, and the pack's crop nodes are built around Florence's quirk of letterboxing to a square. So on the downstream crop nodes - NB2 Smart Region or Smart Mask Crop - set depad_florence = False for SAM masks. The README is explicit about it: keep depad_florence = true only for Florence-style masks that need letterbox correction. Get this wrong and your crop lands shifted.
Install & keys
Search comfyui-inpaint-cropstitch-nb2 in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/amortegui84/comfyui-inpaint-cropstitch-nb2
Restart. This node calls FAL, so you need a key - api_key field or FAL_KEY env var set before launching ComfyUI (fully restart, not a browser refresh). A 401 on first call is the key not reaching the process. And if you run huge source images and FAL keeps dropping the connection, lower upload_max_dimension to 1536 or 1024 - that's the documented fix.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt | STRING | garment | — |
| selection_modeopt | COMBO | largest | 3 options: largest, first, merge_all |
| padding_percentopt | FLOAT | 0.00–100 | — |
| return_rect_maskopt | BOOLEAN | false | — |
| api_keyopt | STRING | — | |
| api_key_env_varopt | STRING | FAL_KEY | — |
| mask_blur_percentopt | FLOAT | 0.00–100 | Soft blur applied to the returned SAM mask. |
| upload_max_dimensionopt | INT | 2048512–4096 | — |
| return_multiple_masksopt | BOOLEAN | true | — |
| max_masksopt | INT | 31–32 | — |
| include_scoresopt | BOOLEAN | true | — |
| include_boxesopt | BOOLEAN | true | — |
| point_prompts_jsonopt | STRING | — | |
| box_prompts_jsonopt | STRING | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_image | IMAGE | — |
| info | STRING | — |
| center_x | INT | — |
| center_y | INT | — |
| crop_width | INT | — |
| crop_height | INT | — |