Skip to content

Inpainting Backgrounds

David Sage edited this page Jun 19, 2026 · 6 revisions
2025-06-14_10-14-50_9419

Inpainting Background Setup

Background replacement can be an artistic and enjoyable process. With a bit of practice, it can be accurate and relatively easy.

First check the Input Image checkbox below the main canvas and choose the Inpaint or Outpaint tab. Click on the Inpaint canvas and load the source image. In many cases it can be fast and efficient to manually paint over the subject to isolate it from the background.

In this case it would be difficult to preserve the cat's whiskers by trying to paint over them. This is also the case when trying to preserve a human subject with loose strands of hair.

Auto-Masking

So for this example, I selected the Enable Advanced Masking checkbox in the lower right of the Inpaint and Outpaint pane. This enables a selection of several Mask Generation Models that will be used to auto-generate a mask.

The default Masking Model, isnet-general-use often gives good results, but try other models if the mask omits part of the subject or includes too much of the background. The Masking brush can be used to include areas that the automatic process has missed, but instead I typically try a different Masking Model.

The "u2net_human_seg" model can work really well with some human subjects and I have also had great results with "birefnet-general". And "sam", the Segment Anything model, can be used with one of the Quick List prompts to produce some amazing results.

In this case, I allowed the mask to include part of the wall that the cat was sitting on because I thought it would add an interesting feature to the result.

Inpaint Background Setup

How to Enable Background Replacement

Perhaps the most important factor for background replacement, both with manual and automatic masking, is to ensure that the "Invert Mask When Generating" checkbox is selected. This ensures that image generation will work with everything that is not masked, i.e. the background only.

The third Inpainting Method, "Modify Content (add objects, replace background, etc.)" is typically the best one to use for background replacement.

Lastly, enter a prompt to describe the background, either in the Inpaint Additional Prompt textbox or in the main prompt field. Note that any words in the main prompt will affect the outcome, so make sure there are no leftovers in the prompt field that is directly below the canvas.

In this case I chose to place the cat in a "tropical forest background".

Background Replacement Results

When ready, press Generate to make FooocusPlus produce one or more new images. I have included an example below.

For an alternative approach to background replacement, see the Image Editor Backgrounds article in this Wiki.

2025-06-15_13-23-18_3096

Clone this wiki locally