I started using python-pptx for presentations. It is pretty capable, but the documentation is a little lacking. I like to create PowerPoint layouts and save them as a generic presentation then use JMP windows with user inputs to build my Python code.
An example of the first part of one of my PowerPoint presentation scripts:
pycode = Eval Insert(
"\[from pptx import Presentation
from PIL import Image, ImageEnhance
import io
p = Presentation(r'^template_path^')
slid = p.slides[0]
mom = slid.shapes[1]
slid.shapes.title.text = '^pres^'
mom.text = '^name^'
for x in range(^Char( total_items )^):
print("""adding placeholder slides....
""" + str(x + 1) + ' out of ^Char( total_items )^')
p.slides.add_slide(p.slide_layouts[6])
]\"
);
After this it loops through folders of sample inspection images I have. You could create your graphs and save them as jpg files. The following code adds information from a conditions table, pulls only jpg files from the folders, and enhances some of the darker pictures before putting them into the slide. The options are basically endless.
For Each( {v, i}, sub_folders,
condition = Left( Right( v, 4 ), 2 );
pycode ||= Eval Insert(
"slid = p.slides[^Char( i )^]
slid1 = slid.placeholders[10]
slid2 = slid.placeholders[11]
slid3 = slid.placeholders[12]
slid4 = slid.placeholders[13]
slid5 = slid.placeholders[14]
slid6 = slid.placeholders[15]
slid7 = slid.placeholders[16]
slid8 = slid.placeholders[17]
slid.shapes.title.text = \!"\!"\!"^v || Try( \!": \!" || cond_array[condition], \!"\!" )^\!"\!"\!"\!N"
);
pics = Filter Each( {value, index}, Files In Directory( thefolder || v ),
And( Ends With( Lowercase( value ), "jpg" ), !Contains( value, "_APA_" ) )
);
pycode ||= Eval Insert(
"slid1.insert_picture(r'^thefolder || v || \!"/\!" || pics[1]^')
slid2.insert_picture(r'^thefolder || v || \!"/\!" || pics[3]^')
img = Image.open(r'^thefolder || v || \!"/\!" || pics[5]^')
enh = ImageEnhance.Brightness(img)
img = enh.enhance(3)
img2 = io.BytesIO()
img.save(img2, 'JPEG')
slid3.insert_picture(img2)
img = Image.open(r'^thefolder || v || \!"/\!" || pics[7]^')
enh = ImageEnhance.Brightness(img)
img = enh.enhance(2)
img2 = io.BytesIO()
img.save(img2, 'JPEG')
slid4.insert_picture(img2)
slid5.insert_picture(r'^thefolder || v || \!"/\!" || pics[2]^')
slid6.insert_picture(r'^thefolder || v || \!"/\!" || pics[4]^')
img = Image.open(r'^thefolder || v || \!"/\!" || pics[6]^')
enh = ImageEnhance.Brightness(img)
img = enh.enhance(3)
img2 = io.BytesIO()
img.save(img2, 'JPEG')
slid7.insert_picture(img2)
img = Image.open(r'^thefolder || v || \!"/\!" || pics[8]^')
enh = ImageEnhance.Brightness(img)
img = enh.enhance(2)
img2 = io.BytesIO()
img.save(img2, 'JPEG')
slid8.insert_picture(img2)
print('^Char( i )^ of ^Char( Length( sub_folders ) )^ complete....')\!N"
);
);
pycode ||= Eval Insert( "\[p.slides.add_slide(p.slide_layouts[4])
p.save(r'^pptx_savefile^')
]\" );
I use placeholders to simplify image insertion, but you can directly add images and specify the size and position.