Split Parts
Turn One Image Into Its Pieces With SAM3
- image
- images
- image
You've generated a great product shot, and now you want the logo on a separate layer from the strap, from the buckle - each as its own transparent PNG, ready for a layered editor. That's the job ComfyTV's Split Parts stage exists for: it runs a segmentation workflow and returns one transparent-background image per part, under ComfyTV/Image.
Under the hood it drives SAM3 - Meta's Segment Anything 3, the open-vocabulary version that segments from points, boxes, or text. The stage ships two workflows, selectable in the workflow dropdown:
- SAM3 Points & Boxes (default) - you draw point groups and boxes directly on the node's image card. The stage runs once per point-group and once for all boxes, and
parts_data(hidden JSON of those prompts in source-pixel coordinates) is what carries your drawing to the model. - SAM3 Text - instead of clicking, type a concept in
main_prompt("strap", "buckle", "logo") and the open-vocabulary model segments every instance it finds.
Feed the source through the optional image input and you get two outputs: images (the COMFYTV_IMAGES batch - one transparent PNG per part) and image (a single pick; the selected_index field is the 1-indexed thumbnail pick). The parts then flow into the 2D layer editor for reassembly.
The model file you'll need
SAM3 nodes are ComfyUI core (comfy_extras/nodes_sam3.py), so no extra node pack - but the model itself has to be downloaded once:
# place in ComfyUI/models/checkpoints/
# sam3.1_multiplex_fp16.safetensors
# https://huggingface.co/Comfy-Org/sam3.1
One real gotcha, and it's a Windows one: SAM3's nodes can pull in Triton, which is a well-known obstacle on Windows. If the workflow errors with a Triton/compile message, that's the culprit, not your setup. The text workflow also needs a prompt, or the stage errors with its own message: "Split Parts needs a prompt: click/box the parts to separate on the card, or type a concept (text workflow)."
Install
With ComfyTV:
cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV
Restart ComfyUI; under ComfyTV → Image. ComfyUI Manager: search "ComfyTV". Desktop/macOS: clone into the running instance's absolute custom_nodes (startup-log path), fix any ComfyTV/ComfyTV/ nesting, full backend restart.
Troubleshooting
- Parts come out with black backgrounds, not transparency. The docs flag this exact binding gotcha: the workflow writes
alpha = 1 - mask, so put anInvertMaskin front of the mask when compositing SAM masks to transparency. - Nothing segments. If you drew points/boxes and it still errors, you likely need the prompt path too - or the model file is missing from
ComfyUI/models/checkpoints/(first-run check). - Windows/Triton errors. SAM3's Triton dependency is the known obstacle; that's a platform issue, not a ComfyTV bug.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| force_run_token | INT | 00–2147483647 | Internal — bumped on Run to invalidate ComfyUI's input cache. |
| project_id | STRING | Internal — populated by the projectStore on the frontend. | |
| parent_output_id | INT | 00–2147483647 | Internal — lineage parent set by spawn handlers on the frontend. |
| workflow | COMBO | SAM3 Points & Boxes | Which segmentation workflow to run. |
| parts_data | STRING | Internal — JSON of the part prompts drawn on the card (point groups and boxes, in source-image pixel coords). | |
| main_prompt | STRING | — | |
| selected_index | INT | 11–999 | Internal — 1-indexed cell pick for image-batch stages. Driven by clicking a thumbnail in the node's output grid. |
| custom_params | STRING | {} | Internal — JSON of user-defined parameter attachments/values for this node. |
| imageopt | COMFYTV_IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | COMFYTV_IMAGES | — |
| image | COMFYTV_IMAGE | — |