-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Feature Request] Add FLUX.2 inpaint support #1380
Description
Hi, thanks for the great work on DiffSynth-Studio.
FLUX.2 is already supported for inference and training in the repository, and there is also support for image editing through edit_image in the FLUX.2 pipeline/examples. However, it seems that FLUX.2 still does not support a standard inpainting workflow with an explicit mask input.
It would be very helpful if FLUX.2 inpaint support could be added, for example:
Requested feature
Support masked inpainting for FLUX.2 models (such as FLUX.2-dev / FLUX.2-klein), with an interface similar to:
image/edit_imagemask_image- prompt-guided masked region editing
- keeping unmasked regions unchanged as much as possible
Why this is useful
Many practical editing tasks need localized modification instead of full-image editing, for example:
- replacing or removing local objects
- changing clothing / accessories only in a selected region
- background cleanup
- PPT / poster / design asset partial editing
Right now, edit_image is useful for general image editing, but in many cases we need stricter spatial control through a mask.
Suggested scope
It would be great if the project could provide:
- Inference support in
Flux2ImagePipeline - An example script under
examples/flux2/model_inference/ - Documentation for the expected mask format and recommended preprocessing
- (Optional) training / LoRA examples for inpaint-style tasks in the future
Example expected usage
image = pipe(
prompt="replace the masked area with a red mug",
edit_image=input_image,
mask_image=mask,
num_inference_steps=30,
seed=0,
)非常感谢 DiffSynth-Studio 的工作!
目前仓库已经支持 FLUX.2 的推理和训练,也看到 FLUX.2 有基于 edit_image 的图片编辑能力;不过看起来暂时还没有提供标准的 inpaint(掩码局部重绘) 支持。
希望可以为 FLUX.2 增加 inpaint 能力,例如支持:
edit_imagemask_image- 基于 prompt 的局部区域编辑
- 尽量保持非 mask 区域不变
需求原因
很多实际场景都需要“局部可控编辑”,而不是整图编辑,比如:
- 替换某个局部物体
- 只修改人物衣服/配饰
- 局部背景清理
- 海报/PPT/design asset 的局部修补
edit_image 对整体编辑已经很有帮助,但很多场景还是需要 mask 来提供更强的空间约束。
建议支持内容
- 在
Flux2ImagePipeline中增加 inpaint 推理接口 - 在
examples/flux2/model_inference/下提供示例 - 文档说明 mask 格式、尺寸要求和预处理建议
- (可选)后续补充 inpaint 相关训练 / LoRA 示例
期望的调用方式
image = pipe(
prompt="replace the masked area with a red mug",
edit_image=input_image,
mask_image=mask,
num_inference_steps=30,
seed=0,
)