Outpaint with PirateDiffusion on Telegram
Outpainting is the ability to dynamically extend and stretch the background on a completed image, like zooming out, and the AI fills in the blank extra pixels seamlessly. Adobe calls this “generative fill”, it’s the same thing.
Outpainting requires two things:
- an image as input
- and prompt describing what happens in the new pixels
Start from an image…
And go nuts with outpainting…
How to use Outpainting
Step 1: Provide a starter image
Let’s start with an anime waifu. Is she in her bedroom, or her kitchen?
Step 2: Decide what art style should fill in the gap
Outpainting uses special models. The same models that we use for inpainting are used for outpainting. To see which models are available, type:
If you’re not familiar with these names, type /webui to learn about them and see examples. Outpainting is not in webui yet, but photos of the models are.
Step 3: Reply to an image with /outpaint
Literally reply to the uploaded photo.
/outpaint <revani-inpainting> kitchen, messy, daylight, window, cups, sink, cabinets
And you’re done!
(Optional) Refining the effect
There are various parameters you can also use:
Blur the Canvas
Add a blur range is 1 to 200. The default is 1. You can stack it with zoom.
/outpaint /zoom:12 /blur:100 An art deco cocaine den
Add a zoom range is 0-12. The default is 4. Example:
/outpaint /zoom:12 A dreadfully sunny kitchen
Zoom 4 is the default, and easiest to control. When the zoom is too high, things can get surreal faster. Outpainting in small steps doesn’t necessarily mean things won’t get surreal again on the next zoom, so it’s better to fix those things with inpainting
CONTRACT (but same overall framing)
/outpaint /contract:x option
Looking at the pictures of the effect will help you understand this feature easier. It doesn’t work like zooming in or out. This contracts the mask size to let more of the “edges” of your image repainted . The default value is 64. The range is 0 – 256
Contract technical explanation:
The image is resized to 640x wide, aspect ratio maintained. A bigger image is generated, matching your zoom out setting (at 64 * zoom level). Then a mask is created thats 640 – (contract size) pixels, height scaled to match aspect ratio and filled with black, then blurred. This place is placed inside a region the same size as the bigger image.
Example of contract in action:
first is the original image
Let’s try a contract command with the default value of 64
/outpaint /contract a tropical office
So that’s the default 64 effect. Let’s see what 256 looks like in comparison, the maximum value.
/outpaint /contract:256 a tropical office
As you can see, it takes more leeway in changing the environment around the center of the initial image, so much in fact that the mask touched his hair and made it more tropical. Nice surfer hair, brah! But it keeps the same zoom level (overall framing)
In case you missed it, we also provide a handy tool for instant background removal.
Send a wholly separate render to the left, top, bottom or right. Example:
/outpaint /side:bottom new york city
Problem: I’m trying to outpaint, but its only putting my original picture in a box, what am I doing wrong?
What’s happening: The issue is the background. If the background is a solid color or plain shadow, outpaint doesn’t know how to continue the image. The outer images have to provide outpaint with more hints to extend it.
Solution: First, inpaint a background. Use the Fill tool to select the area around the subject in one click. This allows for a more natural transition when outpainting afterwards.
Very surreal images. Stable Diffusion is surreal by default, but outpainting often results in photos that further defy the rules of physics. If you’re aiming for realism, fix those issues with inpainting after, or try a different paint model or guidance setting. Higher guidance = more strict.
The canvas stays the same size. You can’t outpaint an image into a billion pixels wide, there isn’t enough video ram for much larger images. There is no limit to how much you can outpaint, you can repeat the command over and over to zoom out to infinity, but outpainting doesn’t make the image an infinite number of pixels bigger, it pushes the original image deeper into the canvas, in the same way that cameras work when you take a few steps back.
However, you can upscale your outpaintings for higher resolution results.
And that’s it! Enjoy some examples from our community:
Ye old “Eggs Benadryl” method
Before outpainting was officially supported, it was possible to force our inpaint system to do the generative fill. This still works, if you prefer this way.
Knowing how to use inpaint is a prerequisite for this guide.
Step 1 – First, download the photo you want to work on, or render your image and download it. This image was created by community member, Deacon:
/render your own image or copy the prompt below
/seed:270870 /recipe:fuji 1man, Close up face, muscular Alex Pettyfr as a sweat steampunk cowboy, wearing black cowboy hat, hard muscle, hunky, sweating, ((face visible)) lens flare, optical flare, depth of field, cinematic composition, cinematic lighting, lens dirt, depth focus, (((dark industrial nighttime background))) ((masterpiece, best quality, 8k, raw, canon 5d, f/1.8, iso 6400, wide-angle, Realism, movies, posters, photos,(detailed face), handsome, masterpiece, best quality, highres, realistic, standing, foreshortening, medium shot, ground view)) (high detailed skin:1.2), 8k uhd, dslr, soft lighting <realgalaxy>
Step 2 – Open your image editor and add some white space around the image. We recommend downloading a free app like Photos on Android, Irfanview on Windows desktop, and any similar program that allows the extension of the canvas.
Don’t do too much at once, or you might get recursion. Your app might call this canvas resize, image dimensions resize, etc.
Add about 50% around your image. Your photo should now look something like the image below. The canvas can be any color, we are going to paint over in Step 5. Save your image to your computer or phone.
Step 3 – Upload this modified image back into Telegram.
During the upload process, Telegram will ask if you want to send it “quick” or “with compression” — say yes, check that box. Otherwise, we can’t read it.
PS. If you don’t care for buff cowboys, we have more examples below.
Step 4: Reply to the image with an inpaint command describing both what is already in the photo and the other things that you want to see around it.
/inpaint a sexy shirtless man at a rodeo
A link to the brush tool will appear. Click on that, and use the large brush to erase both the extended canvas as well as the shape around the subject, so everything looks more consistent when it comes back
Tada! We have our sexy man at a rodeo…
…but he’s surrounded by other sexy men at the rodeo.
If your prompt is too short, it will repeat your instructions to fill in the blanks, so make sure you are clear: 1man, a bull in the background, stadium lights, clowns, aliens, etc. Give it something to work with, or you’ll get twins.
Repeat these steps to make the image even bigger and fix imperfections!
If your mask was ignored, try setting your device to “desktop mode” or using the native PC version of Telegram. We tested this in Chrome on Android and iOS, so other browsers like Opera may not be fully supported.
Please contact us in VIP chat if you have any questions!
Also see: ControlNet
Special thanks to “Eggs Benadryl” for these great examples
A challenge! Can you finish it? (hint: Fallout)
Can you prompt a few happy trees into the void?
The possibilities are endless!