python 图片批量格式转换

阅读 159

2022-07-12

# python 图片批量格式转换
import glob
import os
import threading

from PIL import Image


def create_image(infile, index):
os.path.splitext(infile)
im = Image.open(infile)
im.save(str(index) + ".png", "PNG")


def start():
index = 0
for infile in glob.glob("./*.webp"):
t = threading.Thread(target=create_image, args=(infile, index,))
t.start()
t.join()
index += 1


if __name__ == "__main__":
start()


精彩评论(0)

0 0 举报