--- title: Outpainting --- # :octicons-paintbrush-16: Outpainting ## Outpainting and outcropping Outpainting is a process by which the AI generates parts of the image that are outside its original frame. It can be used to fix up images in which the subject is off center, or when some detail (often the top of someone's head!) is cut off. InvokeAI supports two versions of outpainting, one called "outpaint" and the other "outcrop." They work slightly differently and each has its advantages and drawbacks. ### Outpainting Outpainting is the same as inpainting, except that the painting occurs in the regions outside of the original image. To outpaint using the `invoke.py` command line script, prepare an image in which the borders to be extended are pure black. Add an alpha channel (if there isn't one already), and make the borders completely transparent and the interior completely opaque. If you wish to modify the interior as well, you may create transparent holes in the transparency layer, which `img2img` will paint into as usual. Pass the image as the argument to the `-I` switch as you would for regular inpainting: invoke> a stream by a river -I /path/to/transparent_img.png You'll likely be delighted by the results. ### Tips 1. Do not try to expand the image too much at once. Generally it is best to expand the margins in 64-pixel increments. 128 pixels often works, but your mileage may vary depending on the nature of the image you are trying to outpaint into. 2. There are a series of switches that can be used to adjust how the inpainting algorithm operates. In particular, you can use these to minimize the seam that sometimes appears between the original image and the extended part. These switches are: --seam_size SEAM_SIZE Size of the mask around the seam between original and outpainted image (0) --seam_blur SEAM_BLUR The amount to blur the seam inwards (0) --seam_strength STRENGTH The img2img strength to use when filling the seam (0.7) --seam_steps SEAM_STEPS The number of steps to use to fill the seam. (10) --tile_size TILE_SIZE The tile size to use for filling outpaint areas (32) ### Outcrop The `outcrop` extension gives you a convenient `!fix` postprocessing command that allows you to extend a previously-generated image in 64 pixel increments in any direction. You can apply the module to any image previously-generated by InvokeAI. Note that it works with arbitrary PNG photographs, but not currently with JPG or other formats. Outcropping is particularly effective when combined with the [runwayML custom inpainting model](INPAINTING.md#using-the-runwayml-inpainting-model). Consider this image: