Skip to content

Outpaint

Vladimir Mandic edited this page Feb 9, 2025 · 3 revisions

Outpainting

Following guide is based on Control tab functionality

Note

Screenshots are using Standard UI, but functionality using Modern UI is the same

How does it work?

Outpaint is combination of expand image + use original image as mask area + trigger inpaint
Result is that newly expanded area is now outpainted while original image remains unchanged

Select what to outpaint

There are several ways to use outpainting

  • If you know exactly by how much you want to outpaint,
    Easiest is to simply specify outpaint size using resizing method
  • If you want to experiment interactively,
    You can zoom in/out and/or move input image using interactive method
    Note: this method is very powerful, but can be finicky due to Gradio image control usability limitations

Note

Settings noted at the bottom apply to both methods

Resize Outpaint

  • Select Control tab
  • Upload image
    Image
    Note: Status bar will display image details:

    Control input | Image | Size 768x768 | Mode RGB

  • In Size settings
    Select Before -> Mode -> Outpaint
    Select desired size
    Note: Size can be either fixed resolution or scale-by

Note

Resize outpaint mode is different than normal resize since it does not resize input image directly
Instead it creates new image and places original image in the center of newly created larger image with remaining areas marked for outpainting

Image vs Inpaint Method

With resize outpaint, you again have two options:

  • By uploading input image to Select tab
    You will be using Image-to-Image outpaint mode
    Which will perform seamless integration of outpainted area,
    but will also allow modifications input content as well
    Note: when using this mode, you must use prompt that includes description of the original image
    to allow it to be blended and avoid replacing it completely
  • By uploading input image to Outpaint tab
    You will be using Inpaint-with-Mask outpaint mode
    Which will maintain input image,
    but will make it more difficult to blend outpainted area
    Note: when using this mode, experiment with mask blur/errode/dilate values

Example:
Image

Interactive Outpaint

  • Select Control tab
  • In Input panel, select Outpaint tab
    Interactive outpaint is only available when using outpaint tab
  • Upload image
    Image
    Note: Status bar will display image details:

    Control input | Image | Size 768x768 | Mode RGB

  • Click on edit button in the top-right corner of the image
  • Using mouse resize edges of the image
    Confirm resize with the left click
    Image
    Note: Status bar will display updated image details:

    Control input | Image | Size 898x768 | Mode RGB

  • Use mouse scroll to zoom out and left-click drag to position image
    Image
    Confirm with left click
    Image
    Note: Status bar will display updated image details:

    Control input | Image | Size 929x929 | Mode RGB

Note

Instead of uploading image to outpaint tab,
you can use send to feature to transfer generated image from Text/Image/Control tabs

Tip

Note that after confirming expand/zoom/reposition with the mouse click
image may look the same so pay attention to the status bar!
This is the limitation of current Gradio and we're looking at possible replacements for native canvas

Example
Image

Settings

Strength

In Input settings
set denoising strength to a high value (at least 0.55 or higher)
so outpaint can freely create new content

Image

Warning

using low denoising strength will result in expanded image, but not actually outpainted
Image

Mask

In Mask settings
you can control amount of edge blur/erode/dilate between original image and outpained section

Tip

Start with 0 for blur/erode/dilate and increase as needed

Image

By allowing larger overlap between original image and outpainted region,
outpaint will be more context-aware since it can "fit" in the image better,
but it will also change edges of original image

Clone this wiki locally