Free Open Source AI Image Background Remover with CLI Mode: Rembg

Editor Ratings:
User Ratings:
[Total: 6 Average: 3.3]

Rembg is a free open-source AI background remover for images. Here it takes a JPG, PNG image and generates a PNG image with the background removed. It doesn’t come with any limitations as it is open source and you run it on your own computer. Or, if you have a server somewhere, then you can use it on that as well. There is a simple command that you have to issue on command line to remove background from an image.

Apart from the command line, you can use it as an API as well. It comes with a microservice built-in already. You can run the microservice as a server and make simple POST requests to the endpoint to remove backgrounds from the images. Apart from straight background removal, it has some other features as well that you will like. See the list below to see what it can do.

  • Remove the background from a remote image. If the image is not available locally and is hosted online then you can use its link to remove its background.
  • Supports both CPU and GPU for processing the image.
  • It can help you remove the background using a specific model.
  • Remove the background returning only the mask.
  • It supports removing the background after applying an alpha matting.
  • Bulk remove background from multiple images in batch.
  • Rembg can be used as a microservice.
  • For developers, Rembg comes as a library. You can add background removing functionality in your apps and web apps.
  • It comes as a Docker container. You can grab the Docker image and deploy it quickly anywhere.

Free AI Based Photo background Remover

Free Open Source AI Image Background Remover with CLI Mode: Rembg

Using Rembg is very simple. Even if you don’t have a high-power GPU, you can still use the CPU version. Using it only requires that you have Python installed. After installing Python, just run this command below to install it. This will install the CPU version of Rembg.

pip install rembg

Install Rembg

If you want to install Rembg with GPU support, then install using this command.

pip install rembg[gpu]

After it has been installed successfully, you can start using it right away. The basic syntax of running the command is this.

rembg i path_to_input.png path_to_output.png

Rembg in action

So, use the command above and place the input and output file names accordingly. Hit enter and then wait for a few seconds. When the command has finished successfully, you will find the output PNG image in the output folder.

Similarly, you can use it as a server. For that, you will have to first start the microservice using the command below.

rembg s

rembg server running

Now, from the terminal, you issue this cURL command and then wait for the output.

curl.exe -s -F file=@/path/to/input.jpg "http://localhost:5000" -o output.png

Running as a server

There are other supported features in it that you can use, for example, to remove the background from image sub bulk, run this command.

rembg p path/to/input path/to/output

To remove background from an image using a specific model, use the following command. You will have to manually look for the models that can be used with Rembg. Some of them are listed on its GitHub page itself.

rembg p path/to/input path/to/output

If you want to apply an alpha matting, then use the command below to do it.

rembg i -a path/to/input.png path/to/output.png

In this way, you can use this powerful open-source image background remover. Information about the other technical usage of Rembg as a library can be found on the GitHub Readme. If you are a programmer then you can take a look at that. There are also example and details about the Docker deployment guide.

Closing thoughts:

We have many AI background remover tools such as here and here, but not an open source one. Being open source, Rembg here gives you the freedom to remove background from any kind of photo and image. Here you don’t have any limitations. However, for removing background from high resolution images, it may take some time. So, I will suggest you to try it on a PC with good GPU configuration such as Azure.

Editor Ratings:
User Ratings:
[Total: 6 Average: 3.3]
Free/Paid: Free

Leave A Reply


Get 100 GB FREE

Provide details to get this offer