32为png图转24位jpg图

import os

from PIL import Image

path = r'E:\xunlian3'
newpath = r'E:\xunlian3'


def image(path):
    files = os.listdir(path)
    for i in files:
        files = os.path.join(path, i)
        img = Image.open(files).convert('RGB')
        dirpath = newpath
        file_name, file_extend = os.path.splitext(i)
        dst = os.path.join(os.path.abspath(dirpath), file_name + '.jpg')
        img.save(dst)


image(path)

猜你喜欢

转载自blog.csdn.net/MissLemonh/article/details/122374277