{ "id": "7df1cda8-0d0d-403a-8c08-8a3841b6ec6b", "revision": 0, "last_node_id": 18, "last_link_id": 24, "nodes": [ { "id": 1, "type": "UNETLoader", "pos": [ -40, -500 ], "size": [ 340, 82 ], "flags": {}, "order": 1, "mode": 0, "inputs": [], "outputs": [ { "name": "MODEL", "type": "MODEL", "slot_index": 0, "links": [ 7 ] } ], "properties": { "Node name for S&R": "UNETLoader", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "flux1-fill-dev-fp8.safetensors", "default" ], "title": "Load Flux Fill Model (fill or onereward)" }, { "id": 2, "type": "CheckpointLoaderSimple", "pos": [ -40, -340 ], "size": [ 340, 100 ], "flags": {}, "order": 2, "mode": 0, "inputs": [], "outputs": [ { "name": "MODEL", "type": "MODEL", "slot_index": 0, "links": [] }, { "name": "CLIP", "type": "CLIP", "slot_index": 0, "links": [ 4 ] }, { "name": "VAE", "type": "VAE", "slot_index": 0, "links": [ 10, 18 ] } ], "properties": { "Node name for S&R": "CheckpointLoaderSimple", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "flux1-dev-fp8.safetensors" ], "title": "CLIP+VAE source (MODEL unused)" }, { "id": 3, "type": "LoadImage", "pos": [ -40, -140 ], "size": [ 270, 330 ], "flags": {}, "order": 3, "mode": 0, "inputs": [], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "slot_index": 0, "links": [ 1, 11, 20, 22 ] }, { "name": "MASK", "type": "MASK", "slot_index": 0, "links": [] } ], "properties": { "Node name for S&R": "LoadImage", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "example.png", "image" ], "title": "Main Image" }, { "id": 5, "type": "SAM3Segment", "pos": [ 300, -140 ], "size": [ 300, 320 ], "flags": {}, "order": 5, "mode": 0, "inputs": [ { "name": "image", "type": "IMAGE", "link": 1 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "slot_index": 0, "links": [] }, { "name": "MASK", "type": "MASK", "slot_index": 0, "links": [ 2, 3 ] }, { "name": "MASK_IMAGE", "type": "IMAGE", "slot_index": 0, "links": [] } ], "properties": { "Node name for S&R": "SAM3Segment", "cnr_id": "comfyui-rmbg", "aux_id": "1038lab/ComfyUI-RMBG", "ver": "3.0.0" }, "widgets_values": [ "person", "Merged", 0.5, 0, 0, 0, 0, "Auto", false, false, "Alpha", "#222222" ], "title": "Segment PERSON (SAM3)" }, { "id": 6, "type": "GrowMaskWithBlur", "pos": [ 640, -140 ], "size": [ 300, 250 ], "flags": {}, "order": 6, "mode": 0, "inputs": [ { "name": "mask", "type": "MASK", "link": 2 } ], "outputs": [ { "name": "mask", "type": "MASK", "slot_index": 0, "links": [] }, { "name": "mask_inverted", "type": "MASK", "slot_index": 0, "links": [ 12 ] } ], "properties": { "Node name for S&R": "GrowMaskWithBlur", "cnr_id": "comfyui-kjnodes", "aux_id": "kijai/ComfyUI-KJNodes", "ver": "1.2.5" }, "widgets_values": [ -4, 0.0, true, false, 8.0, 1.0, 1.0, true ], "title": "Background mask (inverted)" }, { "id": 7, "type": "CLIPTextEncode", "pos": [ 300, -420 ], "size": [ 380, 160 ], "flags": {}, "order": 7, "mode": 0, "inputs": [ { "name": "clip", "type": "CLIP", "link": 4 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "slot_index": 0, "links": [ 5, 6 ] } ], "properties": { "Node name for S&R": "CLIPTextEncode", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "sharp photorealistic background, same scene, crisp focus, fine natural texture, clean detail, natural depth, lighting and color temperature matching the subject, no blur, no artifacts, high detail, 4k" ], "title": "Background prompt" }, { "id": 8, "type": "ConditioningZeroOut", "pos": [ 700, -480 ], "size": [ 280, 50 ], "flags": {}, "order": 8, "mode": 0, "inputs": [ { "name": "conditioning", "type": "CONDITIONING", "link": 5 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "slot_index": 0, "links": [ 9 ] } ], "properties": { "Node name for S&R": "ConditioningZeroOut", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [], "title": "Negative (zeroed)" }, { "id": 9, "type": "FluxGuidance", "pos": [ 700, -380 ], "size": [ 280, 60 ], "flags": {}, "order": 9, "mode": 0, "inputs": [ { "name": "conditioning", "type": "CONDITIONING", "link": 6 } ], "outputs": [ { "name": "CONDITIONING", "type": "CONDITIONING", "slot_index": 0, "links": [ 8 ] } ], "properties": { "Node name for S&R": "FluxGuidance", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ 30.0 ] }, { "id": 10, "type": "DifferentialDiffusion", "pos": [ 300, -520 ], "size": [ 280, 60 ], "flags": {}, "order": 10, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 7 } ], "outputs": [ { "name": "MODEL", "type": "MODEL", "slot_index": 0, "links": [ 13 ] } ], "properties": { "Node name for S&R": "DifferentialDiffusion", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ 1.0 ] }, { "id": 11, "type": "InpaintModelConditioning", "pos": [ 1020, -420 ], "size": [ 300, 170 ], "flags": {}, "order": 11, "mode": 0, "inputs": [ { "name": "positive", "type": "CONDITIONING", "link": 8 }, { "name": "negative", "type": "CONDITIONING", "link": 9 }, { "name": "vae", "type": "VAE", "link": 10 }, { "name": "pixels", "type": "IMAGE", "link": 11 }, { "name": "mask", "type": "MASK", "link": 12 } ], "outputs": [ { "name": "positive", "type": "CONDITIONING", "slot_index": 0, "links": [ 14 ] }, { "name": "negative", "type": "CONDITIONING", "slot_index": 0, "links": [ 15 ] }, { "name": "latent", "type": "LATENT", "slot_index": 0, "links": [ 16 ] } ], "properties": { "Node name for S&R": "InpaintModelConditioning", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ true ], "title": "Flux Fill conditioning" }, { "id": 12, "type": "KSampler", "pos": [ 1360, -420 ], "size": [ 300, 450 ], "flags": {}, "order": 12, "mode": 0, "inputs": [ { "name": "model", "type": "MODEL", "link": 13 }, { "name": "positive", "type": "CONDITIONING", "link": 14 }, { "name": "negative", "type": "CONDITIONING", "link": 15 }, { "name": "latent_image", "type": "LATENT", "link": 16 } ], "outputs": [ { "name": "LATENT", "type": "LATENT", "slot_index": 0, "links": [ 17 ] } ], "properties": { "Node name for S&R": "KSampler", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ 720559880485925, "randomize", 24, 1.0, "euler", "normal", 1.0 ] }, { "id": 13, "type": "VAEDecode", "pos": [ 1700, -420 ], "size": [ 210, 50 ], "flags": {}, "order": 13, "mode": 0, "inputs": [ { "name": "samples", "type": "LATENT", "link": 17 }, { "name": "vae", "type": "VAE", "link": 18 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "slot_index": 0, "links": [ 19 ] } ], "properties": { "Node name for S&R": "VAEDecode", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [] }, { "id": 14, "type": "GrowMaskWithBlur", "pos": [ 640, 260 ], "size": [ 300, 250 ], "flags": {}, "order": 14, "mode": 0, "inputs": [ { "name": "mask", "type": "MASK", "link": 3 } ], "outputs": [ { "name": "mask", "type": "MASK", "slot_index": 0, "links": [ 23 ] }, { "name": "mask_inverted", "type": "MASK", "slot_index": 0, "links": [] } ], "properties": { "Node name for S&R": "GrowMaskWithBlur", "cnr_id": "comfyui-kjnodes", "aux_id": "kijai/ComfyUI-KJNodes", "ver": "1.2.5" }, "widgets_values": [ 6, 0.0, true, false, 12.0, 1.0, 1.0, true ], "title": "Person keep mask (grow+feather)" }, { "id": 15, "type": "ImageResizeKJ", "pos": [ 1700, -300 ], "size": [ 300, 190 ], "flags": {}, "order": 15, "mode": 0, "inputs": [ { "name": "image", "type": "IMAGE", "link": 19 }, { "name": "get_image_size", "type": "IMAGE", "link": 20, "shape": 7 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "slot_index": 0, "links": [ 21 ] }, { "name": "width", "type": "INT", "slot_index": 0, "links": [] }, { "name": "height", "type": "INT", "slot_index": 0, "links": [] } ], "properties": { "Node name for S&R": "ImageResizeKJ", "cnr_id": "comfyui-kjnodes", "aux_id": "kijai/ComfyUI-KJNodes", "ver": "1.2.5" }, "widgets_values": [ 1024, 1024, "lanczos", false, 0, "disabled" ], "title": "Resize to original size" }, { "id": 16, "type": "ImageCompositeMasked", "pos": [ 2040, -420 ], "size": [ 300, 170 ], "flags": {}, "order": 16, "mode": 0, "inputs": [ { "name": "destination", "type": "IMAGE", "link": 21 }, { "name": "source", "type": "IMAGE", "link": 22 }, { "name": "mask", "type": "MASK", "link": 23, "shape": 7 } ], "outputs": [ { "name": "IMAGE", "type": "IMAGE", "slot_index": 0, "links": [ 24 ] } ], "properties": { "Node name for S&R": "ImageCompositeMasked", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ 0, 0, false ], "title": "Original person over new background" }, { "id": 17, "type": "SaveImage", "pos": [ 2380, -420 ], "size": [ 400, 460 ], "flags": {}, "order": 17, "mode": 0, "inputs": [ { "name": "images", "type": "IMAGE", "link": 24 } ], "outputs": [], "properties": { "Node name for S&R": "SaveImage", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "flux-bg-inpaint" ], "title": "Save Image" }, { "id": 18, "type": "MarkdownNote", "pos": [ -40, -940 ], "size": [ 620, 380 ], "flags": {}, "order": 18, "mode": 0, "inputs": [], "outputs": [], "properties": { "Node name for S&R": "MarkdownNote", "cnr_id": "comfy-core", "ver": "0.3.48" }, "widgets_values": [ "## Flux BG Inpaint (Flux.1 Fill / OneReward)\n\n**True masked inpainting of the background with FLUX.1 Fill dev (fp8), person auto-masked by [SAM3](https://github.com/1038lab/ComfyUI-RMBG)** (needs [ComfyUI-RMBG](https://github.com/1038lab/ComfyUI-RMBG) + [ComfyUI-KJNodes](https://github.com/kijai/ComfyUI-KJNodes))\n\n- **Note**: Fill cannot see the masked-out background, so it invents a NEW scene behind the person (guided only by the prompt and the subject). For \"same scene but sharper\" use `qwen-bg-enhance` / `qwen-bg-inpaint-true` / `flux2-bg-inpaint` instead - this workflow is for full background replacement.\n- **Model**: pick in *Load Flux Fill Model*: `flux1-fill-dev-fp8` (official Fill weights) or `flux1-fill-dev-onereward-fp8` (ByteDance OneReward variant, tuned for context-aware inpaint). CLIP + VAE come from the `flux1-dev-fp8` checkpoint - its MODEL output is unused.\n- **Sampling**: FluxGuidance `30` (Fill's recommended range), 24 steps euler/normal, CFG 1, denoise 1.0, DifferentialDiffusion for softer mask blending.\n- **Background mask**: person mask shrunk 4px + 8px feather, inverted - regen bites slightly into the subject edge so no halo survives. Fill preserves the subject natively; the final composite pastes the original person back on top as a guarantee (keep mask `expand 6 / blur 12`).\n- Output is resized back to the exact input resolution before the composite.\n- Via API: `--set 3.image=file.png`, `--set 1.unet_name=flux1-fill-dev-onereward-fp8.safetensors`, `--set 7.text='...'`.\n\n**Models** (all in [aleph65/ComfyUI](https://huggingface.co/aleph65/ComfyUI)): `flux1-fill-dev-fp8`, `flux1-fill-dev-onereward-fp8`, `flux1-dev-fp8` (checkpoint, for CLIP+VAE), `sam3.pt`\n" ], "title": "README", "color": "#432", "bgcolor": "#653" } ], "links": [ [ 1, 3, 0, 5, 0, "IMAGE" ], [ 2, 5, 1, 6, 0, "MASK" ], [ 3, 5, 1, 14, 0, "MASK" ], [ 4, 2, 1, 7, 0, "CLIP" ], [ 5, 7, 0, 8, 0, "CONDITIONING" ], [ 6, 7, 0, 9, 0, "CONDITIONING" ], [ 7, 1, 0, 10, 0, "MODEL" ], [ 8, 9, 0, 11, 0, "CONDITIONING" ], [ 9, 8, 0, 11, 1, "CONDITIONING" ], [ 10, 2, 2, 11, 2, "VAE" ], [ 11, 3, 0, 11, 3, "IMAGE" ], [ 12, 6, 1, 11, 4, "MASK" ], [ 13, 10, 0, 12, 0, "MODEL" ], [ 14, 11, 0, 12, 1, "CONDITIONING" ], [ 15, 11, 1, 12, 2, "CONDITIONING" ], [ 16, 11, 2, 12, 3, "LATENT" ], [ 17, 12, 0, 13, 0, "LATENT" ], [ 18, 2, 2, 13, 1, "VAE" ], [ 19, 13, 0, 15, 0, "IMAGE" ], [ 20, 3, 0, 15, 1, "IMAGE" ], [ 21, 15, 0, 16, 0, "IMAGE" ], [ 22, 3, 0, 16, 1, "IMAGE" ], [ 23, 14, 0, 16, 2, "MASK" ], [ 24, 16, 0, 17, 0, "IMAGE" ] ], "groups": [], "config": {}, "extra": { "frontendVersion": "1.45.20" }, "version": 0.4 }