AI Background Remover Plugin for GIMP

Sujeet Kumar
5 Min Read

This is a Gimp plugin that allows you to remove the background of images with just one click, and it does it through layer masks, so it removes the background non-destructively.

This plugin is based on the rembg tool, which is an open-source AI tool for removing background.

Also, this plugin works on your PC, so you donā€™t need internet access to use it.

How to Install:

5e5db148d220412f6c330d8b63647349 - AI Background Remover Plugin for GIMP

To get this plugin working, first you have to install the rembg tool.

To install this, you have to run this command in the terminal if you are on Linux or in PowerShell if you are on Windows. (Make sure you open the terminal or PowerShell as administrator)

There are two commands for installing this: one is for the CPU only, and another is for the GPU, so decide which one you want to install.

CPU support:

pip install rembg

GPU support:

pip install rembg[gpu]

After installing this, you now install the Gimp plugin in Gimp.

Now extract the plugin and open it in a text editor. Then replace the user with your own PCā€™s username, and if you are on Linux, replace this whole path with your own path where rembg is installed.

fd450eeabedc00320ddec5deab86dbde - AI Background Remover Plugin for GIMP

Note: There are two things you need to understand before going further: First, use a double backslash in the path shown above. If the plugin does not work, check your Python version, then replace the Python version name in the path with your python version.

Linux: /home/UserName/.local/bin/rembg

Windows Original: C:\\Users\\UserName\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\rembg.exe

Windows Changed: C:\\Users\\UserName\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\rembg.exe

Then put the plugin file (RemoveBG.py) in this folder.

8ef5abf667d19006a16ab622220e60b4 - AI Background Remover Plugin for GIMP

After installing and setting up the plugin, you will see a new menu called ā€œPython-Fu.ā€ Here you will see the plugin, and you can use it by clicking on it.

5fb69bfba7bbd00138a14642c88c20c5 - AI Background Remover Plugin for GIMP

Just make sure to enable the ā€œmaskā€ option so it can remove the background with a layer mask.

df6a63ef5a48569f0f6a611b8b18cfa1 - AI Background Remover Plugin for GIMP

Troubleshoot

If youā€™re experiencing trouble installing or getting this plugin to work, then this section is for you. Letā€™s first understand how this plugin works. When you install ā€œrembgā€ through the terminal or command prompt, it installs an AI tool that removes backgrounds from images. The Python GIMP plugin simply connects to the ā€œrembgā€ tool. So, when you enable the plugin in GIMP and try to use it, it utilizes ā€œrembgā€ to remove the background. It temporarily stores the image in a temp file and then provides access to GIMP, offering a seamless experience.

If the plugin doesnā€™t work for you, it likely means that the ā€œrembgā€ tool is not functioning properly, as GIMPā€™s plugin relies on it for background removal.

image 42 - AI Background Remover Plugin for GIMP

So, how can you fix this? First, you need to locate where the ā€œrembgā€ tool is installed on your PC. In Windows, it is usually installed inside the Python script folder, which can be found here: C:\Users\YourUserName\AppData\Local\Programs\Python.

image 43 - AI Background Remover Plugin for GIMP

In this location, you will see a Python folder with the name of your Python version. If you have multiple Python folders (e.g., Python310, Python39), navigate into each Python folder. Inside the ā€œscriptsā€ folder, you will find a file named ā€œrembg.exe.ā€ If you locate it, copy its file path location and format it correctly. By default, it has one backslash, but you need to add two backslashes (e.g., C:\\Users\\YourUserName\\AppData\\Local\\Programs\\Python\\YourPythonVersion\\Scripts\\rembg.exe).

image 44 - AI Background Remover Plugin for GIMP

you should test the ā€œrembgā€ tool from each Python folder. If the first folder doesnā€™t work, try the next one, and continue this process until you find a working installation. If you canā€™t locate the ā€œrembgā€ file inside the ā€œscriptsā€ folder of a particular Python folder, that folder is not useful for this purpose. In that case, move on to the next Python folder and repeat the same steps as explained in the previous section to find the ā€œrembgā€ file inside the ā€œscriptsā€ folder.

image 7 - AI Background Remover Plugin for GIMP

Some other tips for fixing this:

  • If your Windows system is set to a different language than English, it could be causing problems with the pluginā€™s access to the temp folder. Try changing your Windows system language to English and see if that resolves the issue.
  • Another potential solution is to either downgrade or upgrade your Python version. However, keep in mind that ā€œrembgā€ recommends a Python version higher than 3.7 and lower than 3.12.

TAGGED: ,
Share This Article
SK, an ardent writer whose creativity knows no bounds. With a profound love for anime, a fascination for the world of VFX, and an insatiable appetite for innovative storytelling, SK embarks on a journey where art and artificial intelligence converge to bring captivating narratives to life.