话不多说,直接看代码!
import os
from PIL import Image
def read_path(file_pathname): # 函数的输入是图片所在的路径
for filename in os.listdir(file_pathname):
print(filename) # 所操作图片的名称可视化
img = Image.open(file_pathname+'/'+filename) # 读取文件
im_rotate = img.rotate(90) #图像旋转
im_rotate.save("F:\\aliyun\\LOL\\xy90normal" + "/" + filename) # 图片保存
read_path(r"F:\aliyun\LOL\xynormal")