import comtypes.client
import os
import win32
import glob
print('ss111s')
path = r'D:\pythonCode\excel_to_img\report3.pptx'
pa = r"D:\pythonCode\excel_to_img"
'''
fileNames = glob.glob(pa + r'\*')
for fileName in fileNames: #将pa 文件夹中的文件删除。
os.remove( fileName)
'''
powerpoint = comtypes.client.CreateObject("kwpp.Application") #使用wps的接口
#powerpoint.Visible = 1
ppt = powerpoint.Presentations.Open(path)
# 另存为
ppt.SaveAs(pa + '.jpg', 17)
# 退出
ppt.Close()
powerpoint.Quit()
python将ppt另存为图片
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240825082459112-376424429.jpg)