# Outpainting

Outpainting refers to the task of extending parts of an image some amount of pixels. For example, using the reference photo from the inpainting tutorial, we can use Auto 1111 SDK's outpainting feature to extend it 128 pixels in the left. The photo's original dimensions were 768x1024, and now they are 896x1024:

<figure><img src="/files/7nnWuZKd1mJ6fqRIxvoq" alt="" width="375"><figcaption><p>Original photo</p></figcaption></figure>

<figure><img src="/files/txzqq6ZwUQydQ9PUkyRv" alt="" width="375"><figcaption><p>Outpainted photo</p></figcaption></figure>

***

Just like Inpainting, Outpainting with Auto 1111 SDK doesn't require a different pipeline object. You can use the same pipeline object that you used to generate the image to outpaint the image, though it is recommended that you use a dedicated inpainting model, which you can find on Civit AI: <https://civitai.com/>. In this example, I will be using the dreamshaper v8 inpainting pipeline: <https://civitai.com/models/4384?modelVersionId=131004>. Here's how you can outpaint with Auto 1111 SDK:

1. Initialize your pipeline. This process is the same for inpainting. To download the model, you can use Auto 1111 SDK's Civit AI model downloader.

   ```
   from auto1111sdk import StableDiffusionPipeline
   inpainting_pipe = StableDiffusionPipeline("dreamshaper_v8Inpainting.safetensors")
   ```
2. Open the image

```
from PIL import Image
image = Image.open("photo.png")
```

3. Outpaint

```
output = pipe.poor_mans_outpainting_img2img(steps=10, prompt = prompt, direction=["left"], negative_prompt=negative_prompt, init_images = image)
```

You can leave the prompt and negative prompt as the same as the original photo. Currently, Auto 1111 SDK only supports poor mans outpainting.&#x20;

***

### Parameters

Currently, Auto 1111 SDK supports the following parameters (and the corresponding default values):

```python
init_image: a PIL Image object
prompt: str
negative_prompt: str = ''
seed: int = -1
steps: int = 20
cfg_scale: float = 7.5
sampler_name: str = "Euler"
denoising_strength: float = 0.75
pixels: int = 128 # the number of pixels you want to outpaint in each specified direction
mask_blur: int = 4
directions: list = ["left"] # the directions you want to outpaint in. Can include multiple directions, including ["left", "right", "up", "down"]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://flush-ai.gitbook.io/automatic-1111-sdk/pipelines/outpainting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
