用的是pillow
打开文件,遍历文件中的图像名字,修改访问地址。
修改图片。像是一个假的图片遍历,目前就这个水平啦。
run。
from PIL import Image
import os
files = os.listdir('./ori_img')
for item in files:
item = "./ori_img/"+item
print(item)
img=Image.open(item)
img.show()
width, height = 358, 441
img = img.resize((width, height))
img.save(item,dpi = (300.0,300.0))