-
-
Notifications
You must be signed in to change notification settings - Fork 428
Inpaint and Outpaint
This guide shows how to use both inpainting and outpainting.
For both inpainting and outpainting you must use a model fine-tuned for inpainting, such as
stabilityai/stable-diffusion-2-inpainting
. Follow the instructions to download a model.
Inpainting refers to filling in or replacing parts of an image. It can also be used to make existing textures seamless.
The quickest way to inpaint is with the Mark Inpaint Area brush.
- Use the Mark Inpaint Area brush to remove the edges of the image
- Enter a prompt for what should fill the erased area
- Enable Source Image, select the Open Image source and the Inpaint action
- Choose the Alpha Channel mask source
- Click Generate
Inpainting can also be used to make an existing texture seamless.
- Use the Mark Inpaint Area brush to remove the edges of the image
- Enter a prompt that describes the texture, and check Seamless
- Enable Source Image, select the Open Image source and the Inpaint action
- Click Generate
Outpainting refers to extending an image beyond its original size. Use an inpainting model such as stabilityai/stable-diffusion-2-inpainting
for outpainting as well.
- Select an image to outpaint and open it in an Image Editor
- Choose a size, this is how large the outpaint will be
- Enable Source Image, select the Open Image source and the Outpaint action
- Set the origin of the outpaint. See Choosing an Origin for more info.
The top left corner of the image is (0, 0), with the bottom right corner being the (width, height).
You should always include overlap or the outpaint will be completely unrelated to the original. The add-on will warn you if you do not include any.
Take the image below for example. We want to outpaint the bottom right side. Let's figure out the correct origin.
Here's what we know:
- We know our image is 512x960. You can find this in the sidebar on the Image tab.
- We set the size of the outpaint to 512x512 in the Dream tab
With this information we can calculate:
- The X origin will be the width of the image minus some overlap. The width is 512px, and we want 64px of overlap. So the X origin will be set to
512 - 64
or448
. - The Y origin will be the height of the image minus the height of the outpaint size. The height of the image is 960px, and the height of the outpaint is 512px. So the Y origin will be set to
960 - 512
or448
.
Tip: You can enter math expressions into any Blender input field.
After selecting this origin, we can outpaint the bottom right side.
Here are other values we could have used for other parts of the image:
- Bottom Left:
(-512 + 64, 512 - 64)
or(-448, 448)
- Top Right:
(512 - 64, 0)
or(448, 0)
- Top Left:
(-512 + 64, 0)
or(-448, 0)
- Top:
(0, 0)
- Bottom:
(0, 512 - 64)
or(0, 448)