Reputation: 308
Is there a way of converting a pptx
file into png
files for each slide using Python?
I was thinking of converting pptx into pdf and then converting each pages into png but not sure if it is the optimal way.
Upvotes: 0
Views: 6690
Reputation: 111
To build on natter1's answer, two things that I had to do to get save_pptx_as_png to work on Windows:
If you don't do this, you may run into errors such as "Comptype module needed to save PNGs" or COMError "The system cannot find the path specified."
Upvotes: 1
Reputation: 394
You could also use python-pptx-interface - it has something similar to what Mukesh linked as built in function:
from pptx_tools.utils import save_pptx_as_png
# use full path for pptx_filename
save_pptx_as_png(folder_to_save_pngs, pptx_filename, overwrite_folder=True)
overwrite_folder=True is needed, if the folder already exists. In that case, PNGs might be overwritten.
Upvotes: 1
Reputation: 944
It's possible on windows using comtypes library. But same cannot be said for unix distributions because comtypes isn't supported in unix. For windows,if you couldn't figure it out:
https://gist.github.com/littmus/6496277
There is also python-pptx library but it doesn't have privilege for allowing to take Screenshot (Correct me if I am wrong.) In the meanwhile, this is really interesting question according to me, since there are many threads for the same, if you get it please post the answer over here.
Upvotes: 1