fbpx

How to remove a background in Stable Diffusion via WebUI or Telegram

Want to remove the background of an image when working in Stable Diffusion? You can use our tools for that. Our software can easily remove background of any rendered AI image. You can also use the tool to remove backgrounds from non-AI photos or drawings.

WebUI Method

  1. First, click Get Started and make sure you’re logged in. Then render or upload an image.
  2. Click Tools. A new Remove BG button will appear
  3. Choose the color and type of image, and remove the image!  That’s all there is to it.

Telegram Method

To do this, start by uploading the image to our Telegram Bot and then send this handy two letter command. Then simply type: /bg

And that’s all there to it. You don’t have to draw a mask or anything, it just works. By default, it will replace the background with solid black. This is configurable.  

The tool is designed for realistic photographs by default, but you can also use it for illustrated works, and set the background color to anything you’d like.

Additional Parameters

  • /format:png – Download a true transparent PNG.  It otherwise defaults to a high-res nearly uncompressed JPG with a black background.
  • /color – you can recolor the background to any color, by supplying a HEX value with or without the pound sign. It is not case sensitive, either. Example: /color:FFFFFF will give you a white background. And here’s a handy color picker.
  • /anime – improves masks and edges quality for any kind of illustrated works, by better detection of illustrated subjects in the foreground
  • /masks – this returns only the masks, and not the image. The average user probably doesn’t need this, but the power user will surely ask, so here you go!

Try it out

For example, try it on PirateDiffusion, our popular Telegram Client

  1. First render a photo, or upload the example above to follow along.
  2. Next, reply to that photo with /bg as shown below
  3. Then type: /bg /anime /color:FF4433 

Let’s say I wanted yellow instead, so I just change the color to FFFF00

 

Advanced Technique

Reply to the mask with /showprompt to get the image code used in inpainting (or pick it from the inpainting recent masks list) – use /maskinvert to paint the background instead of foreground

Troubleshooting

If your uploaded photo wasn’t recognized, try another way. Some Android smartphones provide shortcut tray apps for quick image uploading, and that seems to confuse Telegram into thinking that your photo is an attachment. Instead, use your File Manager and go all the way to the photo directory to upload the file instead. Turn on “use compression”.

Limitations

When there are multiple characters in a scene, it may get confused. It seems to choose the characters that are most well lit and whose faces are most clear. In Telegram, you can use the built-in mobile pen tool, or the inpaint tool to prep the image first before using /bg

Some lighting conditions and cluttered backgrounds may also result in a partial background removal.  Prompting for “bokeh background” before rendering is the easiest way to get around this, as it will intelligently remove anything blurred in one shot.

Worst case, you can always inpaint the background or tiny details away.