安裝 Rembg : 在命令提示字元下,輸入 pip install rembg[cli] 即可
安裝完後,輸入 rembg i path/to/input.png path/to/output.png 測試一下,是否安裝成功
path/to/input.png 是你要去背景的來源檔案,jpg 也可以
path/to/output.png 是去背完成後的輸出檔案
(第一次執行,會從網路下載預訓練的模型)
底下是它的範例輸出
RemoveBG.zip 是給 Gimp(Windows版) 與 Rembg 交互的 plugin,以利後續的編修合成
下載後,用文字編輯器打開,找到
aiExe = "C:\\Users\\USER\\AppData\\Local\\Programs\\Python\\Python39\\Scripts\\rembg.exe"
把它替換成 rembg 在你電腦上安裝的路徑後,再存檔
如果你是用 Linux 用戶
而且是使用 Flatpak GIMP,那可以下載 RemoveBG-Flatpak.zip
如果是AppImage GIMP或其它非使用Sandbox的GIMP,那可以下載 RemoveBG-AppImage.zip
一樣用文字編輯器打開,找到
aiExe = "/home/jamesh/.local/bin/rembg"
把它替換成你的安裝路徑後,再存檔
之後Flatpak版再以以下方式啟動Gimp
flatpak run --socket=session-bus org.gimp.GIMP
AppImage GIMP 直接啟動即可
使用 :
在 Python-Fu -> AI移除影像背景 ...
10 則留言:
Hello!
Is this plugin by any chance on free license? Header says "software that can be used not only for personal use, but also for commercial use by individuals/companies", but I'm not sure if it allows modification of your code. I'm asking because I modernized it a bit - removed lossy compression, changed some lines to more proper python, added new models, added ability to run without showing console and added benchmark routine. If it would be on MIT license or GPL, I could publish in on GitHub - and maybe other people would make it even better. Of course your author note would remain.
all my plugins were free licence, you can do what ever you want
Hi
What about the development of this extension?
Will it be rewritten for GIMP 2.99/3.0?
Because it cannot be used with new GIMP 2.99/30 with a new API.
Hello! Very useful little script you have here!
I found something with the 2023-02-09 dated version, that I think I didn't see with an older one but I'm not sure (I was using that until recently that I realized there is a new version).
When the layer is bigger or smaller than the canvas, and both are not aligned in the top, right or both, the RemoveBG result mask is shifted. Images talk better here than thousands words: https://i.imgur.com/HgGz2rX.png https://i.imgur.com/8qi5b3t.png
Thanks for your work!
PD.: I deleted the older comment to add the example of a bigger canvas than the layer.
I had fix that error
You can download again
Tested and It looks like fixed.
Thanks!
you're welcome
幫補充比較詳細的安裝方法
Linux Flatpak版GIMP 2.10,外掛路徑是在 ~/.var/app/org.gimp.GIMP/config/GIMP/2.10/plug-ins/
把RemoveBG.py放進去後還要chmod +x RemoveBG.py賦予執行權限,才會顯示在GIMP的選單上。
謝謝您的補充
張貼留言