-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove_background.py
25 lines (19 loc) · 1003 Bytes
/
remove_background.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
from datetime import datetime
from rembg import remove
from PIL import Image
import easygui
input_path = easygui.fileopenbox(title='Select image to remove background: ',
filetypes=[["*.png", "*.jpg", "Image files"]])
image_input = Image.open(input_path)
output = remove(image_input)
current_time = datetime.now().strftime('%Y%m%d_%H%M%S')
output_path = easygui.filesavebox(title='Save file to: ',
default='C:\\Users\\Monika\\Desktop\\'
+ current_time + '.png',
filetypes=[["*.png", "*.jpg", "Image files"]])
# output_path = easygui.filesavebox(title='Save file to: ',
# default='specify the path to the destination folder',
# filetypes=[["*.png", "*.jpg", "Image files"]])
output.save(output_path)
# output.save(output_path + current_time + '_test.png')
exit()