压缩算法替换为Image.Resampling.LANCZOS
之前的算法Image.ANTIALIAS会提示即将过期;
import os
path = r'J:\\cleanpng001'
list_png = [os.path.join(path,i) for i in os.listdir(path) if i.endswith('png')]
print(list_png)
path2 = r'J:\\cleanpng002'
from PIL import Image
num = 0
for f in list_png:
img = Image.open(f)
#(x,y) = img.size
#print(x,y)
out = img.resize((100,100),Image.Resampling.LANCZOS)
#img.save(path2 + '\\{}'.format(img.split("\\")[-1]))
out.save(os.path.join(path2,str(num)+'.png'))
num = num + 1