power-pptx

Rendering Thumbnails

The thumbnail renderer shells out to LibreOffice (soffice) to produce PNG previews of slides — handy for agent feedback loops, CI visual diffs, or gallery pages like this one.

Requirements

  • soffice (LibreOffice) on PATH
  • pdftoppm (Poppler) or pypdfium2 for the PDF→PNG split path

Without them you get ThumbnailRendererUnavailable — catch it to degrade gracefully.

Usage

from power_pptx import Presentation

prs = Presentation("deck.pptx")
prs.render_thumbnails(out_dir="thumbs")        # every slide → PNG
from power_pptx.render import render_slides

# Selected slides with a name template
render_slides(
    prs,
    slides=[0, 1, 2],
    out_dir="thumbs",
    name_template="slide-{:02d}.png",
)

Each call uses a private workspace and LibreOffice profile. Reusing out_dirreturns only the current render's requested slides, even when the deck gets shorter. Unrelated files are preserved; matching output filenames are replaced. Intermediate files are cleaned up, and return_bytes=True does not write output files.

The agent feedback loop

  1. Agent generates the deck and calls slide.tidy().
  2. render_thumbnails() produces PNGs of the result.
  3. The agent (or a human) inspects the thumbnails and iterates.

Combined with audit(prs).markdown(), this closes the loop between generation and verification without ever opening PowerPoint.