from PIL import Image
import os
file_dir = '原始图片路径'
out_dir = '输出路径
img = os.listdir(file_dir)
for i in img:
print(i)
I = Image.open(file_dir+i)
L = I.convert('L')
L.save(out_dir+i)
from PIL import Image
import os
file_dir = '原始图片路径'
out_dir = '输出路径
img = os.listdir(file_dir)
for i in img:
print(i)
I = Image.open(file_dir+i)
L = I.convert('L')
L.save(out_dir+i)