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:
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.
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.
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.
Just make sure to enable the āmaskā option so it can remove the background with a layer mask.
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.
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.
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).
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.
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.