标签:encoding list form version htm 图片 option 特殊 sts
-h
选项查看具体的用法。path/to/file | description |
---|---|
bin/cwebp.exe | encoding tool |
bin/dwebp.exe | decoding tool |
bin/gif2webp.exe | gif conversion tool |
bin/vwebp.exe | webp visualization tool |
bin/webpinfo.exe | webp analysis tool |
lib/ | static libraries |
include/webp | headers |
test.webp | a sample WebP file |
test_ref.ppm | the test.webp file decoded into the PPM format |
cwebp [-preset <...>] [options] in_file [-o out_file]
dwebp in_file [options] [-o out_file]
import os
import sys
decoder_path = r"path/to/dwebp.exe" # Windows10下其实也支持斜杠/路径
webp_path = r"path/to/webp" # webp文件所在目录,需要webp文件名不要有空格!
res_path = r"path/to/png_res" # 存储转换后图片的目录,假设是png
if not os.path.exists(res_path) :
os.mkdir("result")
for f in os.listdir(webp_path):
res_f = str(f).replace("webp", "png") # 若webp文件命名有特殊,这里需要改改映射规则
cmd = "{0} {1} {2}".format(
decoder_path, os.path.join(webp_path, f), os.path.join(res_path, res_f))
os.system(cmd)
标签:encoding list form version htm 图片 option 特殊 sts
原文地址:https://www.cnblogs.com/LittleSec/p/11625217.html