由于要在网页上使用图片渐进加载,所以需要将其他图片格式转化为JPEG格式
考虑使用python来实现批量转换
需要先安装pillow:
pip install pillow
我这里将JPG格式转化为JPEG:
code:
from PIL import Image def jpg2jpeg(path_in, path_out): img = Image.open(path_in) img.save(path_out, "JPEG", quality=80, optimize=True, progressive=True) path = "D:" jpg = ".jpg" jpeg = ".jpeg" for i in range(1, 15): source = path+str(i)+jpg target = path+str(i)+jpeg jpg2jpeg(source, target)