This guide will introduce you to the concept of outpainting in AI image generation and how to create an outpainting workflow in ComfyUI. We will cover:

  • Using outpainting workflow to extend an image
  • Understanding and using outpainting-related nodes in ComfyUI
  • Mastering the basic outpainting process

About Outpainting

In AI image generation, we often encounter situations where an existing image has good composition but the canvas area is too small, requiring us to extend the canvas to get a larger scene. This is where outpainting comes in.

Basically, it requires similar content to Inpainting, but we use different nodes to build the mask.

Outpainting applications include:

  • Scene Extension: Expand the scene range of the original image to show a more complete environment
  • Composition Adjustment: Optimize the overall composition by extending the canvas
  • Content Addition: Add more related scene elements to the original image

ComfyUI Outpainting Workflow Example Explanation

Preparation

1. Model Installation

Please ensure that you have at least one SD1.5 model file in the ComfyUI/models/checkpoints folder. If you are not sure how to install a model, please refer to the Start ComfyUI’s AI Drawing Journey section for instructions on model installation.

You can use the following models:

2. Input Image

Prepare an image you want to extend. In this example, we will use the following image:

3. Outpainting Workflow

Download the image below and drag it into the ComfyUI interface or use the menu Workflow —> Open (Shortcut Ctrl + O) to load this outpainting workflow

Outpainting Workflow Usage Explanation

The key steps of the outpainting workflow are as follows:

  1. Load the locally installed model file in the Load Checkpoint node
  2. Click the Upload button in the Load Image node to upload your image
  3. Click the Queue button or use the shortcut Ctrl + Enter to execute the image generation

In this workflow, we mainly use the Pad Image for outpainting node to control the direction and range of image extension. This is actually an Inpaint workflow, but we use different nodes to build the mask.

Pad Image for outpainting Node

This node accepts an input image and outputs an extended image with a corresponding mask, where the mask is built based on the node parameters.

Input Parameters

Parameter NameFunction
imageInput image
leftLeft padding amount
topTop padding amount
rightRight padding amount
bottomBottom padding amount
featheringControls the smoothness of the transition between the original image and the added padding, higher values create smoother transitions

Output Parameters

Parameter NameFunction
imageOutput image represents the padded image
maskOutput mask indicates the original image area and the added padding area

Node Output Content

After processing by the Pad Image for outpainting node, the output image and mask preview are as follows:

You can see the corresponding output results:

  • The Image output is the extended image
  • The Mask output is the mask marking the extension areas