不多说,直接上函数
import os.path
from PIL import Image
# img_file:图片的路径
# path_save:保存路径
# width:宽度
# height:长度
def img_resize(img_file, path_save, width,height):
img = Image.open(img_file)
new_image = img.resize((width,height),Image.BILINEAR)
new_image.save(os.path.join(path_save,os.path.basename(img_file)))