-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeta 3.py
51 lines (33 loc) · 860 Bytes
/
beta 3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import pip
def install(package) :
pip.main(['install', package])
try:
from rembg import remove
from tkinter import *
from tkinter import filedialog
except:
install("rembg")
install("-U Pillow")
install("tkinter")
from PIL import Image
from rembg import remove
from tkinter import *
from tkinter import filedialog
def openfile():
filepath=filedialog.askopenfilename()
global value
value = filepath
window = Tk()
window.title('image background remover')
# Set window size
window.geometry("400x100")
#Set window background color
window.config(background = "black")
button= Button(text="select the image location",command=openfile)
button.pack()
window.mainloop()
input_path = value
output_path = 'output.png'
input = Image.open(input_path)
output = remove(input)
output.save(output_path)