当前位置 : 主页 > 编程语言 > python >

python 图片批量格式转换

来源:互联网 收集:自由互联 发布时间:2022-07-07
# 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
# 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()


上一篇:python 打印下标和值
下一篇:没有了
网友评论