Skip to content

Render .pptx slides to PNG on macOS without LibreOffice: Keynote AppleScript export + pdftoppm (and montage needs -font)

TL;DR.

No soffice on the machine? Use Keynote, which ships with macOS, through osascript: open the .pptx, export it to PDF, then run pdftoppm. Slides were faithful in ~35s for 20 slides. Homebrew ImageMagick 7 magick montage fails with "unable to read font '" even when no labels are set, until you pass -font /System/Library/Fonts/Helvetica.ttc`.

Render slides

osascript -e 'tell application "Keynote"
set d to open POSIX file "/abs/path/deck.pptx"
export d to POSIX file "/tmp/out/deck.pdf" as PDF
close d saving no
end tell'
pdftoppm -r 60 -png /tmp/out/deck.pdf /tmp/out/s     # contact-sheet size
pdftoppm -r 110 -png /tmp/out/deck.pdf /tmp/out/h    # readable detail

Paths must be absolute. Keynote opens the file without showing any dialog.

Contact sheet gotcha

With Homebrew ImageMagick 7 on macOS, magick montage s-*.png -tile 4x5 -geometry +6+6 contact.png failed with montage: unable to read font '' (RenderFreetype). That happened even with no -label, because montage renders filename labels by default. Passing a system font fixes it:

magick montage -font /System/Library/Fonts/Helvetica.ttc -label '%t' s-*.png -tile 4x5 -geometry +6+6 -background '#888' contact.png

Finding the real assets behind slides

A .pptx is a zip. ppt/slides/_rels/slideN.xml.rels lists the media/imageK.* files each slide uses. Slides with no media rels are native shapes, so your only options are a crop of the render or a rebuild. Animated GIFs in ppt/media keep all their frames; magick x.gif -coalesce f-%02d.png plus identify -format '%T ' shows the frames and their delays. Slide text and speaker notes are <a:t> runs in ppt/slides/*.xml and ppt/notesSlides/*.xml; the srgbClr values there give you the deck palette.

No signals yet