背景除去: RMBG 3.0
RMBG 3.0 は硬いマスクではなく滑らかなグレースケールのアルファマットを生成するため、髪・ガラス・ベール・液体の透明感がそのまま残ります。画像を読んだ vision モデルが切り抜き指示を書き、素材について一言添えるとさらに調整できます。
概要
RMBG 3.0 renders a soft grayscale alpha matte instead of a hard mask, so hair, glass, veils and liquid keep real transparency. A vision model writes the matting instruction from your image; add one sentence about the material to refine it.
Graph: 71614996-81e0-4af2-8540-a63693a3169f, ImageCompare, LoadImage, MarkdownNote, MaskPreview, SaveImage. Output: image (utility_rmbg3_remove_background.png).
入力するもの
- ワークフローを読み込み中
ComfyUI で実行できます。 このワークフローはこのページでは実行できません。ダウンロードしてComfyUIで開いてください。
ワークフローをダウンロードワークフローの内部
ノードグラフの読み取り専用プレビューです。ノードを編集するには、Comfy Cloudで開くかダウンロードしてください。
Loading the graph
Open full-size workflow previewこのワークフロー内のファイル
- 出力
- 画像
- 作成者
- 著者は利用できません
カスタムノードが必要です
- ワークフローを読み込み中
コードからこのワークフローを使用する
可能な場合はワークフローグラフと入力から生成されます。それ以外の場合は保存された例が表示されます。料金が発生する場合があるため、コードを実行する前に認証情報とエンドポイントを確認してください。
What you need
- Runs on
- Comfy Cloud
- キー
- COMFY_API_KEY
有料の Cloud プランとクレジットが必要です。
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"10": {
"class_type": "LoadImage",
"inputs": {
"image": "withered_hydrangeas_still_life_vintage_lit.png"
},
"_meta": {
"title": "Load Image (source)"
}
},
"24": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": None,
"image_a": [
"10",
0
],
"image_b": [
"146:34",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"168": {
"class_type": "MaskPreview",
"inputs": {
"mask": [
"146:163",
0
]
},
"_meta": {
"title": "Preview Mask"
}
},
"170": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "rmbg3/background",
"images": [
"146:147",
0
]
},
"_meta": {
"title": "SaveImage"
}
},
"171": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "rmbg3/foreground",
"images": [
"146:34",
0
]
},
"_meta": {
"title": "SaveImage"
}
},
"146:1": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "rmbg3_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"146:147": {
"class_type": "JoinImageWithAlpha",
"inputs": {
"alpha": [
"146:148",
0
],
"image": [
"10",
0
]
},
"_meta": {
"title": "Join Image with Alpha"
}
},
"146:148": {
"class_type": "GrowMask",
"inputs": {
"expand": 0,
"mask": [
"146:163",
0
],
"tapered_corners": True
},
"_meta": {
"title": "Grow Mask"
}
},
"146:156": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_4b_int8_convrot.safetensors",
"device": "default",
"type": "stable_diffusion"
},
"_meta": {
"title": "Load CLIP"
}
},
"146:157": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "You are the prompt writer for an image matting model (RMBG 3.0). You receive a photo and, optionally, a short note from the user about what the subject is or what material it is made of.\n\nAlways answer with ONE paragraph (max 90 words) that instructs the image model to render a grayscale transparency map of the main subject:\n- pure black background;\n- near-white for every opaque part of the subject, naming them as they appear in this image;\n- middle gray for see-through parts (glass, tulle, sheer fabric, liquid, smoke, mesh), dark gray only for the thinnest of them;\n- the entire subject must stay present and opaque parts must not be turned transparent;\n- keep continuous gray gradients inside the shape, and exclude the backdrop and any reflection or shadow on the ground.\n\nRules that override any other reading:\n- A part the note calls transparent, translucent or glass maps to middle gray (dark gray where it is thinnest) - NEVER to near-white.\n- Colour never implies opacity: coloured glass, coloured liquid and coloured mesh are still see-through and get gray, never white.\n- Only parts that are solid in the note and in the photo (skin, fabric, petals, stems, metal, wood) get near-white.\n\nIf the note is empty, decide the opaque / see-through split from the image alone. If the note names a material or what the thing is, treat it as authoritative and let it override what you would otherwise guess.\n\nReply with the instruction only."
},
"_meta": {
"title": "Text (System Prompt)"
}
},
"146:158": {
"class_type": "TextGenerateV2",
"inputs": {
"clip": [
"146:156",
0
],
"images.image1": [
"10",
0
],
"max_length": 512,
"mtp": "auto",
"prompt": [
"146:178",
0
],
"sampling_mode": "on",
"sampling_mode.min_p": 0.05,
"sampling_mode.presence_penalty": 0,
"sampling_mode.repetition_penalty": 1.05,
"sampling_mode.seed": 0,
"sampling_mode.temperature": 0.7,
"sampling_mode.top_k": 64,
"sampling_mode.top_p": 0.95,
"system_prompt": [
"146:157",
0
],
"thinking": True,
"use_default_template": True
},
"_meta": {
"title": "Generate Text"
}
},
"146:159": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"146:177",
0
],
"on_true": [
"146:158",
0
],
"switch": False
},
"_meta": {
"title": "If/Else Switch"
}
},
"146:160": {
"class_type": "AdjustBrightness",
"inputs": {
"factor": 1,
"images": [
"146:6",
0
]
},
"_meta": {
"title": "Adjust Brightness"
}
},
"146:161": {
"class_type": "AdjustContrast",
"inputs": {
"factor": 1,
"images": [
"146:160",
0
]
},
"_meta": {
"title": "Adjust Contrast"
}
},
"146:162": {
"class_type": "ThresholdMask",
"inputs": {
"mask": [
"146:35",
0
],
"value": 0.8500000000000001
},
"_meta": {
"title": "Threshold Mask"
}
},
"146:163": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"146:35",
0
],
"on_true": [
"146:162",
0
],
"switch": False
},
"_meta": {
"title": "If/Else Switch"
}
},
"146:164": {
"class_type": "PreviewAny",
"inputs": {
"source": [
"146:159",
0
]
},
"_meta": {
"title": "Preview as Text"
}
},
"146:177": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": "{\"edit_instruction\": \"Generate a detailed grayscale alpha matte. Map the opaque foreground to white and the background to black. Produce soft, anti-aliased grayscale gradients at the edges of the subject to represent fine details and transparency.\"}"
},
"_meta": {
"title": "Text (Preset Instruction)"
}
},
"146:178": {
"class_type": "StringFormat",
"inputs": {
"f_string": "Write the matte instruction for this image.\n\nUser note about the subject (authoritative when present, may be empty): {a}",
"values.a": [
"146:179",
0
]
},
"_meta": {
"title": "Format Text"
}
},
"146:179": {
"class_type": "PrimitiveStringMultiline",
"inputs": {
"value": ""
},
"_meta": {
"title": "Text ( (User guide))"
}
},
"146:2": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_4b_int8_convrot.safetensors",
"device": "default",
"type": "fibo2"
},
"_meta": {
"title": "Load CLIP"
}
},
"146:3": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"146:34": {
"class_type": "JoinImageWithAlpha",
"inputs": {
"alpha": [
"146:36",
0
],
"image": [
"10",
0
]
},
"_meta": {
"title": "Join Image with Alpha"
}
},
"146:35": {
"class_type": "ImageToMask",
"inputs": {
"channel": "red",
"image": [
"146:161",
0
]
},
"_meta": {
"title": "Convert Image to Mask"
}
},
"146:36": {
"class_type": "InvertMask",
"inputs": {
"mask": [
"146:148",
0
]
},
"_meta": {
"title": "Invert Mask"
}
},
"146:4": {
"class_type": "TextEncodeFibo2",
"inputs": {
"batch_size": 1,
"clip": [
"146:2",
0
],
"height": 0,
"images.image_1": [
"10",
0
],
"negative_prompt": "",
"prompt": [
"146:164",
0
],
"vae": [
"146:3",
0
],
"width": 0
},
"_meta": {
"title": "TextEncodeFibo2"
}
},
"146:5": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"146:4",
2
],
"model": [
"146:1",
0
],
"negative": [
"146:4",
1
],
"positive": [
"146:4",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 42,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"146:6": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"146:5",
0
],
"vae": [
"146:3",
0
]
},
"_meta": {
"title": "VAEDecode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)関連するワークフロー
- Nano Banana Pro, Gemini3 Pro Image Preview, Google
キャラクターターンアラウンドを作成
- Qwen-Image-Edit
素材を変更
- Qwen-Image-Edit
被写体を新しいアングルから見る
- Flux.2 Dev, Flux
製品モックアップを作成
- Nano Banana Pro
キャラクターに衣装を試着
- Seedream
商品を新しいシーンに配置
- SSeedVR2
アップスケールとディテール復元
- Nano Banana Pro
商品写真をシャープに
- Topaz
イラストをアップスケール
- HHitPaw
ポートレートのディテールを復元
- FLUX.1 Fill
選択した領域を編集
- FLUX.1 Fill
画像の境界を拡張