ComfyUI / workflows /api /flux-bg-inpaint.json
aleph65's picture
Add flux-bg-inpaint API workflow
6a08a93 verified
Raw
History Blame Contribute Delete
4.75 kB
{
"1": {
"_meta": {
"title": "Load Flux Fill Model (fill or onereward)"
},
"class_type": "UNETLoader",
"inputs": {
"unet_name": "flux1-fill-dev-fp8.safetensors",
"weight_dtype": "default"
}
},
"10": {
"class_type": "DifferentialDiffusion",
"inputs": {
"model": [
"1",
0
],
"strength": 1.0
}
},
"11": {
"_meta": {
"title": "Flux Fill conditioning"
},
"class_type": "InpaintModelConditioning",
"inputs": {
"mask": [
"6",
1
],
"negative": [
"8",
0
],
"noise_mask": true,
"pixels": [
"3",
0
],
"positive": [
"9",
0
],
"vae": [
"2",
2
]
}
},
"12": {
"class_type": "KSampler",
"inputs": {
"cfg": 1.0,
"denoise": 1.0,
"latent_image": [
"11",
2
],
"model": [
"10",
0
],
"negative": [
"11",
1
],
"positive": [
"11",
0
],
"sampler_name": "euler",
"scheduler": "normal",
"seed": 720559880485925,
"steps": 24
}
},
"13": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"12",
0
],
"vae": [
"2",
2
]
}
},
"14": {
"_meta": {
"title": "Person keep mask (grow+feather)"
},
"class_type": "GrowMaskWithBlur",
"inputs": {
"blur_radius": 12.0,
"decay_factor": 1.0,
"expand": 6,
"fill_holes": true,
"flip_input": false,
"incremental_expandrate": 0.0,
"lerp_alpha": 1.0,
"mask": [
"5",
1
],
"tapered_corners": true
}
},
"15": {
"_meta": {
"title": "Resize to original size"
},
"class_type": "ImageResizeKJ",
"inputs": {
"crop": "disabled",
"divisible_by": 0,
"get_image_size": [
"3",
0
],
"height": 1024,
"image": [
"13",
0
],
"keep_proportion": false,
"upscale_method": "lanczos",
"width": 1024
}
},
"16": {
"_meta": {
"title": "Original person over new background"
},
"class_type": "ImageCompositeMasked",
"inputs": {
"destination": [
"15",
0
],
"mask": [
"14",
0
],
"resize_source": false,
"source": [
"3",
0
],
"x": 0,
"y": 0
}
},
"17": {
"_meta": {
"title": "Save Image"
},
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "flux-bg-inpaint",
"images": [
"16",
0
]
}
},
"2": {
"_meta": {
"title": "CLIP+VAE source (MODEL unused)"
},
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "flux1-dev-fp8.safetensors"
}
},
"3": {
"_meta": {
"title": "Main Image"
},
"class_type": "LoadImage",
"inputs": {
"image": "example.png"
}
},
"5": {
"_meta": {
"title": "Segment PERSON (SAM3)"
},
"class_type": "SAM3Segment",
"inputs": {
"background": "Alpha",
"confidence_threshold": 0.5,
"device": "Auto",
"image": [
"3",
0
],
"invert_output": false,
"mask_blur": 0,
"mask_offset": 0,
"max_segments": 0,
"output_mode": "Merged",
"prompt": "person",
"segment_pick": 0,
"unload_model": false
}
},
"6": {
"_meta": {
"title": "Background mask (inverted)"
},
"class_type": "GrowMaskWithBlur",
"inputs": {
"blur_radius": 8.0,
"decay_factor": 1.0,
"expand": -4,
"fill_holes": true,
"flip_input": false,
"incremental_expandrate": 0.0,
"lerp_alpha": 1.0,
"mask": [
"5",
1
],
"tapered_corners": true
}
},
"7": {
"_meta": {
"title": "Background prompt"
},
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"2",
1
],
"text": "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"
}
},
"8": {
"_meta": {
"title": "Negative (zeroed)"
},
"class_type": "ConditioningZeroOut",
"inputs": {
"conditioning": [
"7",
0
]
}
},
"9": {
"class_type": "FluxGuidance",
"inputs": {
"conditioning": [
"7",
0
],
"guidance": 30.0
}
}
}