python"># -*- coding: utf-8 -*- ''' ''' import os from PIL import Image pic_dir = r"H:\新建文件夹" for filename in os.listdir(path=pic_dir): if filename.startswith("SAM"): pic_path = os.path.join(pic_dir, filename) print (pic_path) img = Image.open(pic_path ) new_size = tuple( [ size//3 for size in img.size] ) # 高度、宽度均变为原来的1/3 new_img = img.resize( new_size) new_name = os.path.join(pic_dir, "small_" + filename) new_img.save(new_name )
python 批量修改图片大小Python代码
最后更新 2018-05-17 08:00 星期四 所属:
Python教程 浏览:362