from PIL import Image
import os.path
import glob
def convertjpg(jpgfile,outdir,width=640, height=640):
img=Image.open(jpgfile)
try:
new_img=img.resize((width,height),Image.BILINEAR)
new_img.save(os.path.join(outdir,os.path.basename(jpgfile)))
except Exception as e:
print(e)
for jpgfile in glob.glob("E:\\Aubo\\tomatoo\\*.jpg"):
convertjpg(jpgfile, "E:\\Aubo\\tomatoo\\enhance")
python批量修改图片分辨率
最新推荐文章于 2023-01-11 00:10:03 发布