Skip to content

shiquda/open-pptd-skill / skills/open-pptd

open-pptd

Flagged

Create, edit, reverse-decompile, and export presentations using the open PPTD format and native pptd compiler. For every PPT task, default deliverables are BOTH (1) a self-contained PPTD project folder (deck.pptd manifest + pages/*.page) and (2) a locally compiled native .pptx with vector shapes, connector arrows, LaTeX math formulas, speaker notes, and native tables. Completely offline — zero dependency on browser automation or cloud logins.

FileKindSize
SKILL.mdskill md16.0 KB
reference/cli.mdmarkdown9.0 KB
reference/design_system/academic/blue-line-courseware/design.mdmarkdown13.9 KB
reference/design_system/academic/deep-blue-atlas/design.mdmarkdown13.5 KB
reference/design_system/academic/paper-white-courseware/design.mdmarkdown14.0 KB
reference/design_system/academic/pastel-derivation/design.mdmarkdown14.6 KB
reference/design_system/academic/teal-green-academic-defense/design.mdmarkdown14.1 KB
reference/design_system/academic/wine-red-data/design.mdmarkdown14.2 KB
reference/design_system/consulting/apricot-white-brief/design.mdmarkdown17.4 KB
reference/design_system/consulting/indigo-due-diligence/design.mdmarkdown11.8 KB
reference/design_system/consulting/marine-blue-research/design.mdmarkdown11.8 KB
reference/design_system/consulting/moss-green-transformation/design.mdmarkdown13.2 KB
reference/design_system/consulting/pine-green-strategy/design.mdmarkdown15.1 KB
reference/design_system/consulting/red-black-growth/design.mdmarkdown12.7 KB
reference/design_system/finance/black-gold-ledger/design.mdmarkdown15.2 KB
reference/design_system/finance/ebony-ledger/design.mdmarkdown14.6 KB
reference/design_system/finance/honey-orange-memo/design.mdmarkdown12.8 KB
reference/design_system/finance/lake-blue-memo/design.mdmarkdown16.0 KB
reference/design_system/finance/prospect-annual/design.mdmarkdown14.6 KB
reference/design_system/finance/rice-paper-annual/design.mdmarkdown11.1 KB
reference/design_system/promotion/aqua-charity-report/design.mdmarkdown15.1 KB
reference/design_system/promotion/cream-collage/design.mdmarkdown12.6 KB
reference/design_system/promotion/pine-soot-pictorial/design.mdmarkdown14.0 KB
reference/design_system/promotion/silk-yellow-magazine/design.mdmarkdown13.3 KB
reference/design_system/promotion/silver-gray-luxury-magazine/design.mdmarkdown13.8 KB
reference/design_system/promotion/travel-green-handbook/design.mdmarkdown15.4 KB
reference/design_system/work/blue-flame-brand/design.mdmarkdown14.6 KB
reference/design_system/work/electric-violet-business/design.mdmarkdown13.0 KB
reference/design_system/work/moon-white-imagery/design.mdmarkdown13.5 KB
reference/design_system/work/sky-blue-wayfinding/design.mdmarkdown15.4 KB
reference/design_system/work/warm-clay-works/design.mdmarkdown13.5 KB
reference/design_system/work/warm-jade-annual-report/design.mdmarkdown15.7 KB
reference/fonts.mdmarkdown6.6 KB
reference/general-poster.mdmarkdown26.8 KB
reference/math.mdmarkdown10.6 KB
reference/pptd.mdmarkdown95.0 KB
reference/shapes.mdmarkdown15.0 KB
reference/slides_categories.mdmarkdown4.6 KB
reference/slides_categories/academic-research.mdmarkdown15.2 KB
reference/slides_categories/analysis-decision.mdmarkdown5.9 KB
reference/slides_categories/brand-creative.mdmarkdown14.7 KB
reference/slides_categories/business-plan.mdmarkdown6.4 KB
reference/slides_categories/education-training.mdmarkdown24.2 KB
reference/slides_categories/management-report.mdmarkdown5.6 KB
reference/slides_categories/tech-engineering.mdmarkdown18.5 KB
reference/tables.mdmarkdown2.2 KB
scripts/convert_pptx.pyexecutablescript2.7 KB
scripts/export_images.pyexecutablescript6.7 KB
scripts/export_pptx.pyexecutablescript4.7 KB
scripts/install_binary.pyexecutablescript17.5 KB
scripts/requirements.txtmanifest228 B
scripts/validate_pptx.pyexecutablescript27.9 KB
tests/fixtures/minimal/minimal.pptdother93 B
tests/fixtures/minimal/pages/01.pageother330 B
tests/test_export_images.pyexecutablescript1.5 KB
tests/test_export_pptx.pyexecutablescript4.2 KB
tests/test_validate_pptx.pyexecutablescript2.8 KB
theme.mdmarkdown16.6 KB
theme_EN.mdmarkdown16.9 KB
theme_previews/academic/blue-line-courseware.jpgbinary51.1 KB
theme_previews/academic/deep-blue-atlas.jpgbinary41.4 KB
theme_previews/academic/paper-white-courseware.jpgbinary52.2 KB
theme_previews/academic/pastel-derivation.jpgbinary50.4 KB
theme_previews/academic/teal-green-academic-defense.jpgbinary55.4 KB
theme_previews/academic/wine-red-data.jpgbinary52.4 KB
theme_previews/consulting/apricot-white-brief.jpgbinary61.1 KB
theme_previews/consulting/indigo-due-diligence.jpgbinary75.5 KB
theme_previews/consulting/marine-blue-research.jpgbinary72.1 KB
theme_previews/consulting/moss-green-transformation.jpgbinary55.9 KB
theme_previews/consulting/pine-green-strategy.jpgbinary74.4 KB
theme_previews/consulting/red-black-growth.jpgbinary63.0 KB
theme_previews/extra/color-stripes-documentary.jpgbinary39.8 KB
theme_previews/extra/dark-themed-data.jpgbinary45.5 KB
theme_previews/extra/dusk-violet-consulting.jpgbinary44.8 KB
theme_previews/extra/fresh-brand.jpgbinary44.7 KB
theme_previews/extra/gold-orange-type-journal.jpgbinary40.5 KB
theme_previews/extra/ink-green-market-trends.jpgbinary47.0 KB
theme_previews/extra/lead-gray-quarterly.jpgbinary43.3 KB
theme_previews/extra/map-strategy.jpgbinary47.0 KB
theme_previews/extra/mist-blue-travelogue.jpgbinary46.3 KB
theme_previews/extra/orange-tech.jpgbinary34.8 KB
theme_previews/extra/pink-purple-diagnosis.jpgbinary30.4 KB
theme_previews/extra/red-black-business.jpgbinary42.6 KB
theme_previews/extra/red-white-business.jpgbinary67.9 KB
theme_previews/extra/xuan-paper-annual.jpgbinary53.3 KB
theme_previews/finance/black-gold-ledger.jpgbinary60.5 KB
theme_previews/finance/ebony-ledger.jpgbinary59.8 KB
theme_previews/finance/honey-orange-memo.jpgbinary69.0 KB
theme_previews/finance/lake-blue-memo.jpgbinary66.7 KB
theme_previews/finance/prospect-annual.jpgbinary64.8 KB
theme_previews/finance/rice-paper-annual.jpgbinary67.5 KB
theme_previews/promotion/aqua-charity-report.jpgbinary60.9 KB
theme_previews/promotion/cream-collage.jpgbinary62.8 KB
theme_previews/promotion/pine-soot-pictorial.jpgbinary82.1 KB
theme_previews/promotion/silk-yellow-magazine.jpgbinary83.0 KB
theme_previews/promotion/silver-gray-luxury-magazine.jpgbinary66.3 KB
theme_previews/promotion/travel-green-handbook.jpgbinary57.1 KB
theme_previews/work/blue-flame-brand.jpgbinary61.9 KB
theme_previews/work/electric-violet-business.jpgbinary54.2 KB
theme_previews/work/moon-white-imagery.jpgbinary52.5 KB
theme_previews/work/sky-blue-wayfinding.jpgbinary57.6 KB
theme_previews/work/warm-clay-works.jpgbinary49.0 KB
theme_previews/work/warm-jade-annual-report.jpgbinary58.5 KB

scripts/export_images.py

View on GitHub
#!/usr/bin/env python3
"""Offline image export and multi-page preview montage for PPTD projects.

Uses the native pptd compiler + headless document renderer to generate
high-resolution PNG images of every slide and a unified grid overview,
without requiring any browser automation, token authentication, or cloud services.
"""

from __future__ import annotations

import argparse
import os
import re
import shutil
import subprocess
import sys
import tempfile
import time
from pathlib import Path
from typing import Optional, Sequence

from export_pptx import export_pptx


def build_contact_sheet(image_paths: list[Path], output_path: Path, cols: int = 5) -> Optional[Path]:
    """Generate a multi-page overview contact sheet grid using Pillow."""
    if not image_paths:
        return None
    try:
        from PIL import Image
    except ImportError:
        print("[open-pptd-skill] PIL/Pillow not installed; skipping overview contact sheet generation.", file=sys.stderr)
        return None

    try:
        first_im = Image.open(image_paths[0])
        w, h = first_im.size
        thumb_w = 400
        thumb_h = max(1, int(thumb_w * h / w))
        pad = 20

        n = len(image_paths)
        actual_cols = min(cols, n)
        rows = (n + actual_cols - 1) // actual_cols

        total_w = actual_cols * thumb_w + (actual_cols + 1) * pad
        total_h = rows * thumb_h + (rows + 1) * pad

        grid = Image.new("RGB", (total_w, total_h), "#EFECE1")

        for idx, img_p in enumerate(image_paths):
            im = Image.open(img_p).convert("RGB")
            im_resized = im.resize((thumb_w, thumb_h), Image.Resampling.LANCZOS)
            r = idx // actual_cols
            c = idx % actual_cols
            x = pad + c * (thumb_w + pad)
            y = pad + r * (thumb_h + pad)
            grid.paste(im_resized, (x, y))

        output_path.parent.mkdir(parents=True, exist_ok=True)
        grid.save(output_path, "JPEG", quality=90)
        print(f"[open-pptd-skill] Generated contact sheet: {output_path}")
        return output_path
    except Exception as e:
        print(f"[open-pptd-skill] Failed to generate contact sheet: {e}", file=sys.stderr)
        return None


build_montage = build_contact_sheet
def export_images(
    source: Path,
    out_dir: Optional[Path] = None,
    dpi: int = 150,
    force: bool = True,
    pptd_bin: Optional[Path] = None,
) -> Path:
    source = source.expanduser().resolve()
    if not source.exists():
        raise FileNotFoundError(f"Source does not exist: {source}")
    if out_dir is None:
        out_dir = (source.parent if source.is_file() else source) / "qa-images"
    out_dir = out_dir.expanduser().resolve()
    out_dir.mkdir(parents=True, exist_ok=True)

    tmp_dir_obj = tempfile.TemporaryDirectory(prefix="pptd_img_")
    try:
        tmp_dir = Path(tmp_dir_obj.name)
        tmp_pptx = tmp_dir / "render.pptx"

        # Isolate deck directory inside tmp_dir so .sync.hash is never written to user's deck directory
        from export_pptx import find_manifest
        manifest = find_manifest(source)
        source_dir = manifest.parent.resolve()
        tmp_deck_dir = tmp_dir / "deck"
        shutil.copytree(source_dir, tmp_deck_dir, ignore=shutil.ignore_patterns(".*", "*.pptx"))
        isolated_manifest = tmp_deck_dir / manifest.name

        export_pptx(isolated_manifest, output=tmp_pptx, force=force, pptd_bin=pptd_bin)
        soffice = shutil.which("soffice") or shutil.which("libreoffice")
        if not soffice and sys.platform == "darwin":
            mac_soffice = Path("/Applications/LibreOffice.app/Contents/MacOS/soffice")
            if mac_soffice.is_file():
                soffice = str(mac_soffice)

        pdftoppm = shutil.which("pdftoppm")

        if not soffice or not pdftoppm:
            print("[open-pptd-skill] Image rendering requires `soffice` (LibreOffice) and `pdftoppm` (poppler-utils).", file=sys.stderr)
            print("[open-pptd-skill] PPTX was built successfully, but PNG rasterization is unavailable in this environment.", file=sys.stderr)
            return out_dir

        # Convert PPTX to PDF inside temp dir
        subprocess.run(
            [soffice, "--headless", "--convert-to", "pdf", str(tmp_pptx), "--outdir", str(tmp_dir)],
            check=True,
            capture_output=True,
        )
        tmp_pdf = tmp_dir / "render.pdf"

        # Rasterize PDF to slide-NN.png directly into out_dir
        print(f"[open-pptd-skill] Rasterizing slides at {dpi} DPI...")
        prefix = out_dir / "slide"
        subprocess.run(
            [pdftoppm, "-png", "-r", str(dpi), str(tmp_pdf), str(prefix)],
            check=True,
            capture_output=True,
        )

        raw_slides = sorted(
            out_dir.glob("slide-*.png"),
            key=lambda p: int(re.search(r"\d+", p.stem).group(0)) if re.search(r"\d+", p.stem) else 0,
        )
        # Normalize filenames to slide-01.png, slide-02.png (matching slide-NN.png contract)
        pad_width = max(2, len(str(len(raw_slides))))
        rendered_pages: list[Path] = []
        for idx, p in enumerate(raw_slides, 1):
            target_name = out_dir / f"slide-{idx:0{pad_width}d}.png"
            if p != target_name:
                p.rename(target_name)
            rendered_pages.append(target_name)

        print(f"[open-pptd-skill] Successfully exported {len(rendered_pages)} slide images to: {out_dir}")

        # Build overview contact sheet
        contact_sheet_path = out_dir / "contact-sheet.jpg"
        build_contact_sheet(rendered_pages, contact_sheet_path)

    finally:
        try:
            tmp_dir_obj.cleanup()
        except Exception:
            pass
        if os.path.exists(tmp_dir_obj.name):
            shutil.rmtree(tmp_dir_obj.name, ignore_errors=True)

    return out_dir


def main(argv: Optional[Sequence[str]] = None) -> int:
    parser = argparse.ArgumentParser(description="Export a PPTD project to PNG images and contact sheet overview")
    parser.add_argument("source", type=Path, help="Path to deck.pptd manifest or project directory")
    parser.add_argument("-o", "--output", type=Path, default=None, help="Output directory for images (default: qa-images)")
    parser.add_argument("--dpi", type=int, default=150, help="Image DPI (default: 150)")
    parser.add_argument("--force", action="store_true", default=True, help="Force overwrite bypassing .sync.hash protection")
    parser.add_argument("--compiler", type=Path, default=None, help="Explicit path to pptd binary")
    args = parser.parse_args(argv)

    try:
        export_images(args.source, out_dir=args.output, dpi=args.dpi, force=args.force, pptd_bin=args.compiler)
        return 0
    except Exception as err:
        print(f"[open-pptd-skill] Error: {err}", file=sys.stderr)
        return 1

if __name__ == "__main__":
    sys.exit(main())
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall