17 lines
306 B
Python
17 lines
306 B
Python
|
from tqdm import tqdm
|
||
|
|
||
|
def optimize(pxls, back):
|
||
|
old_len = len(pxls)
|
||
|
|
||
|
new_pxls = []
|
||
|
for i in tqdm(range(old_len)):
|
||
|
el = pxls[i]
|
||
|
now_back = [el[2], el[3], el[4]]
|
||
|
|
||
|
if now_back != back:
|
||
|
new_pxls.append(pxls[i])
|
||
|
|
||
|
print(f"Optimized {(old_len - len(new_pxls)) / old_len * 100 }%")
|
||
|
|
||
|
return new_pxls
|