SAM3 - 以提示詞去背

用文字提示從圖片中分離任何主體——只要輸入你想保留的內容(例如 `character`、`dog`、`car`),工作流程就會把它裁切出來並另存為帶透明背景的 PNG。

Input

The photo to cut out.

Name what to keep, in a few words (e.g. "the teapot"); everything else is removed.

Default: character

Advanced settings

Alpha leaves a transparent PNG; Color fills the background with the colour below.

Used when Background is Color, as a hex value.

Default: #222222

Raise it if unrelated things are kept; lower it if parts of the subject go missing.

Keep everything except what you named.

Blurs the cut-out edge, in pixels.

Default: 0

Output
Output
Example

試試範例

關於此工作流程

這個 ComfyUI 工作流程可用簡單的文字提示詞,從任何圖片中分離主體,並匯出具透明背景的 PNG。它把 LoadImage 節點連到 SAM3Segment 節點,再接到 SaveImage。你輸入想保留的內容(例如「character」、「dog」或「red car」),SAM3Segment 節點會產生精準的前景遮罩,並將其套用為 alpha 通道,使其他部分變為透明。

技術上,SAM3Segment 會針對輸入影像做提示詞感知的分割,產生最符合提示詞的區域之二值遮罩。該遮罩會與原始 RGB 合成,輸出 RGBA 去背結果。由於節點預設就能良好運作,多數設定可維持預設值。內附的 MarkdownNote 會快速提醒兩個重點:連接一張圖片,並提供清楚的提示詞。最後 SaveImage 會把去背結果以 PNG 寫出,保留透明度,方便後續在設計、影片或網頁工作流程中合成使用。

問答