how to download or save a picture from a powerpoint ppt with python pptx

无人久伴 提交于 2019-12-06 15:45:58

An image depicted in a Picture shape can be accessed using its image property. The Image object provides access to detailed properties of the image, including the bytes of the image file itself.

http://python-pptx.readthedocs.io/en/latest/api/shapes.html#pptx.shapes.picture.Picture.image

http://python-pptx.readthedocs.io/en/latest/api/image.html#pptx.parts.image.Image

So, for example:

with open('mypic.jpg', 'wb') as f:
    f.write(pic.image.blob)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!