pxl_oboard/remove_back.py
2023-04-23 21:07:56 +03:00

22 lines
424 B
Python

from tqdm import tqdm
def optimize(l):
back = input("Enter background color > ")
new_l = []
for i in tqdm(l):
if i[2] == back:
continue
else:
new_l.append(i)
f = open("out.txt", "w")
f.write(str(new_l))
f.close()
print(f"Lenght before: {len(l)}")
print(f"Lenght after: {len(new_l)}")
optimized = len(l)-len(new_l)
print(f"Optimized: {optimized} ( -{round(optimized/(len(l)/100))}% )")
return new_l