Python代码实现批量输出图片

下面是批量输出图片的Python代码实现:

import os
from PIL import Image

# 图片文件夹的路径
folder_path = 'path/to/image/folder'

# 遍历文件夹中的图片文件
for filename in os.listdir(folder_path):
    # 跳过非图片文件
    if not filename.endswith('.jpg'):
        continue
    # 打开图片文件
    image = Image.open(os.path.join(folder_path, filen

你可能感兴趣的:(Python代码实现批量输出图片)