This is the only feature I'm happy with when creating training materials. Converts to an image file for each PowerPoint page. I've automated the same thing in Python that opens PowerPoint and chooses File → Export → Change File Type.
I used com to operate PowerPoint, and since the file name is variously disgusting with slide 1.PNG, I converted it to slide1.png.
The PowerPoint file name to be read and the output destination are specified at the beginning of the file. Of course, it won't work unless PowerPoint is installed. If you want to try it, I think that it will work if you prepare a PowerPoint file of test.pptx for the time being.
PPT_NAME = 'test.pptx'
OUT_DIR = 'images'
All sources
import os
import glob
from comtypes import client
PPT_NAME = 'test.pptx'
OUT_DIR = 'images'
def export_img(fname, odir):
application = client.CreateObject("Powerpoint.Application")
application.Visible = True
current_folder = os.getcwd()
presentation = application.Presentations.open(os.path.join(current_folder, fname))
export_path = os.path.join(current_folder, odir)
presentation.Export(export_path, FilterName="png")
presentation.close()
application.quit()
def rename_img(odir):
file_list = glob.glob(os.path.join(odir, "*.PNG"))
for fname in file_list:
new_fname = fname.replace('slide', 'slide').lower()
os.rename(fname, new_fname)
if __name__ == '__main__':
export_img(PPT_NAME, OUT_DIR)
rename_img(OUT_DIR)
Recommended Posts