CommunityImagegithub.com

ky-ppt

Free local reconstruction of research figures/schematics into editable PowerPoint (PPTX) or Adobe Illustrator (AI) files; also supports PDF-to-research-presentation PPT (deep purple literature review style: numbered badges, conclusion-style titles, side-by-side evidence cards, had/yet-to-prove limitations pages, bottom summary bars; multi-panel A/B/C/D auto-splitting into cards). Uses vtracer smooth vectorization (default) / OpenCV quantization dual engine + RapidOCR automatic text manifest (optional small VLM for regional semantics) + PyMuPDF parsing + built-in open-source drawing backend, no API key required, zero cost. Use when user says "convert this image to editable PPT/AI", "vectorize research figure", "PDF to presentation PPT", "literature review PPT", "image to native shapes", "use ky_ppt/ky-ppt to process this image". Suitable for flat color blocks and dense research flowcharts; limited effect on complex photographic images.

What is ky-ppt?

ky-ppt is a fully local, zero-cost skill for reconstructing images (research figures, schematics, PDF exports) into natively editable PowerPoint (PPTX) or Adobe Illustrator (AI) files. It supports a two-phase pipeline: (1) an image-to-vector geometry engine using the default 'vtracer' (producing smooth curves and good color gradients) or optional 'opencv' (quantization-based, yielding fewer shapes ideal for flat color blocks), and (2) an optional text/semantic layer that can automatically extract and position text via RapidOCR (precise CPU-level OCR with bounding boxes) or a local Ollama small VLM (e.g., qwen3-vl:2b) for short semantic tasks like region labeling. A separate integrated 'pdf_to_deck' pipeline extracts text, figures, and structure from a PDF to generate a full research presentation PPT in a distinctive deep purple literature review style, featuring evidence cards (with numbered badges and conclusion headers), limitations pages (contrasting known vs. to-be-proven points), and bottom summary bars. Multi-panel composite figures (A/B/C/D) are automatically split into separate cards. The skill outputs native editable shapes and text boxes in PPTX or exports to Illustrator via COM/AppleScript, ensuring maximum editability. Quality checks (e.g., ink recall metrics) are built-in to guarantee fidelity, and the entire process requires no API keys, network calls, or paid services. The skill is best suited for flat schematic diagrams and dense research flowcharts; it has limited ability to reconstruct complex photographic images with high detail and continuous tones.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/jiang-keyi/ky_ppt/tree/HEAD

Installed? Explore more Image skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

ky_ppt

Image → editable PPTX / AI, fully local zero-cost. Three-tier architecture:

  1. Geometry Engine (--engine): Default vtracer (vectorize_vtracer.py, Rust O(n) color stacking + spline fitting, smooth curves, gradient fidelity); Optional opencv (vectorize_local.py, two-stage palette quantization + contours, suitable for pure flat color blocks, use --merge-colors for minimal shapes).
  2. Text/Semantic Layer (optional): Default RapidOCR (ocr_manifest.py, --ocr-manifest, CPU seconds) for precise OCR + text positioning, automatically generates text-manifest, eliminating manual coordinate recording; Optional local Ollama small VLM (vlm_semantics.py, default qwen3-vl:2b) for short semantic tasks like region/title (--mode regions). Note: 2B-level VLM is unstable for dense image character-level bbox OCR; prefer RapidOCR for precise text manifest.
  3. Drawing Backend: Built-in drawing backend (MIT, see LICENSE), geometry + text manifest → native editable PPTX/AI.

Standard Workflow (Research Figures with Text)

  1. Text Manifest (choose one of three):
    • Automatic OCR (recommended): Add --ocr-manifest in step 3. RapidOCR will accurately identify text + bboxes on the original image with text, automatically generating text-manifest.json (CPU seconds, auto-estimates font size/color). If geometry uses a de-texted image, first run ocr_manifest.py --input-image original.png --output text-manifest.json separately, then pass it via --text-manifest to avoid text being baked in twice.
    • Automatic VLM (short semantics): With local Ollama running and ollama pull qwen3-vl:2b, add --vlm-manifest (CPU minutes, suitable for short text like titles/regions; less reliable than RapidOCR for dense character-level OCR).
    • Manual: Read references/text-workflow.md. Record each text's content, pixel coordinates (y is baseline), font size, and color into text-manifest.json (schema_version "1.0", source_canvas as original image width/height, coordinate_space "pixels").
  2. De-text: Use any available image editing model to clear only the text (including watermarks), obtaining a cleaned image. Verify against the original that shapes, layout, colors, lines, and canvas remain unchanged; re-run cleanup if they changed.
  3. Local Reconstruction (zero cost, no payment confirmation needed):
py -3 -X utf8 <skill>/scripts/run_local.py --input-image cleaned.png --text-manifest text-manifest.json --output-root <output directory> --application ppt
  • Default --engine vtracer (better curves/colors); for pure flat color blocks desiring minimal shape count, use --engine opencv --merge-colors.

  • Without a manual manifest, add --ocr-manifest (recommended, RapidOCR) or --vlm-manifest (Ollama) for automatic generation.

  • Use the original resolution from the de-text model, do not downscale beforehand (fine lines and small details will blur). If the resolution differs from the original image, the manifest's source_canvas should still use the original size; coordinates are automatically mapped proportionally.

  • Text layer order is forced on top by code; no need to manually ensure paint_order in the manifest.

  • Output: <output directory>\shibielujingN\shibielujingN.pptx (native editable shapes + text boxes), same directory retains master SVG, geometry cache, and text-manifest.json.

  1. Validation: Use python-pptx to count freeform/text box counts; visually check by exporting PNG from PowerPoint COM and comparing with original. For white canvas issues, first read references/white-overlay-diagnostics.md.

For images without text: skip steps 1-2 and go directly to step 3. For an already approved SVG: use scripts/run_from_svg.py --input-svg ....

PDF → Research Presentation PPT (pdf_to_deck branch)

Organizes a PDF into a set of white-background academic blue presentation PPTs, independent of the "single image → editable shapes" pipeline above.

  • Entry scripts/pdf_to_deck.py: PyMuPDF extracts title/sections/paragraphs/embedded images/tables → outline → python-pptx academic template output (cover / table of contents / section page / key points page / results page / summary).
  • Multi-panel Splitting scripts/split_panels.py: White-space projection cuts A/B/C/D composite figures into individual panels by row/column; RapidOCR only helps identify panel letters; if unrecognized, panels are numbered by row/column order. Panels must be separated by white space/blank space. Splitting is only for grouping into cards; never use one image per page.
  • Default Style (learned and frozen from user references): Deep purple literature review style (main color #7D2E68, light purple #F3E8F2, white background), see references/deck-style-guide.md for details. Main slide types:
    • evidence slide: Deep purple full-width title bar + white circle numbered badge + white theme word → bold black leading sentence (keywords emphasized in purple) → 1–3 side-by-side evidence cards (purple background white text keyword label + full multi-panel composite figure + light purple conclusion bar) → bottom light purple summary bar (process-style "loading → migration → targeting → treatment" or sample size/measurement).
    • limitations slide: Arrow-shaped purple label + "Had: … (black) / Yet-to-prove: … (purple)" contrasting lines.
    • Titles must be conclusion-type with numbers (e.g., "Infarct volume reduced by 26.7%"), retain qualifiers like "not quantified / still pending".
  • Image/Text Rules: Card composite figures embedded as bitmaps, scaled proportionally without cropping; --vectorize-figures is a reserved hook for future conversion of panels via vtracer into editable shapes.
  • Outline Source:
    • --outline outline.json: Assistant fills in a refined outline (titles/key points/figure captions/speaker notes) after reading the PDF; best quality;
    • Without --outline: Offline fallback extracts sentences per section, faithful but dry.
# Offline fallback: PDF direct output
py -3 -X utf8 scripts\pdf_to_deck.py --pdf paper.pdf --output out\deck.pptx

# Assistant outline-driven: First write outline.json, then output
py -3 -X utf8 scripts\pdf_to_deck.py --outline outline.json --output out\deck.pptx

Outline schema (v1.0): {"title","authors","color":{"primary",...},"slides":[{"type":"cover|toc|section|content|evidence|limitations|result|figure|table|conclusion","title","bullets","image","image_caption","table","notes"}]}. evidence slide: {"type":"evidence","number","title","lead","cards":[{"label","image","caption"}],"summary"}; limitations slide: {"type":"limitations","number","title","cards":[{"label","have","todo"}]}. When writing the outline, the assistant should semantically group panels of the same argument into the same card, and extract keyword labels and concluding short sentences for each card.

Limitations: Long papers' key point refinement depends on the assistant/LLM; the pure offline sentence extraction does not polish; complex color images and densely packed panels without white space separation have limited splitting performance.

Illustrator Branch

--application ai. Requires local installation of Illustrator and opening the target document (Windows COM / macOS AppleScript), see references/illustrator-workflow.md for details. If not installed, use scripts/run_illustrator.py --dry-run to verify geometry, or instruct the user to open the master SVG in Illustrator and save as .ai.

Quality Tuning

  • --preset auto|flat|dense: Auto-selects parameters. auto decides based on detail density and number of colors; Use flat (24 colors) for flat color block schematics, and dense (128 colors, min-area 0.5, epsilon 0.3) for dense research flowcharts/small bitmap images. Explicit --max-colors/--min-area/--epsilon/--fit-tol override presets.
  • --max-colors (default 24, max 256): Use 96-128 for complex images/gradient backgrounds
  • --min-area (default 6 px²): Reduce to 0.5-2 for broken thin lines
  • --epsilon (default 0.6 px): Smaller values yield finer detail
  • --no-smooth: Output pure polylines
  • --merge-colors: Merges same-color regions into single composite paths. Reduces PPT shape count from tens of thousands to approximately the number of colors (~130), making open/edit smoother; cost is editing by color rather than by individual element. Recommended for dense images delivered as PPT.
  • Small images (longest side <1600px): Engine automatically 2x upsamples, vectorizes, then scales coordinates back to original canvas to avoid losing 1px strokes.

Quality Gate (Must Run Before Delivery)

py -3 -X utf8 <skill>/scripts/check_quality.py --svg out.svg --source original.png

Renders back and compares to source, outputs mae and ink_recall (dark ink recall, whether text/fine lines are lost). Only deliver when ok:true; low ink_recall indicates lost text, re-run with parameter adjustments per suggestions. Renderer prefers resvg-js (npm install --prefix <skill> @resvg/resvg-js, automatically installed by setup.ps1), fallback svglib (may underestimate fidelity for complex paths; its WARN messages are for reference only).

Constraints & Security

  • SVG Contract: Pure vector, stable IDs, viewBox=canvas, composite paths retain cutouts (nonzero), bottom-to-foreground order; No gradients/CSS/raster/use. validate_vector_svg.py performs automatic validation.
  • Input Protection: Only PNG/JPEG/WebP, ≤40MP; SVG containing <!ENTITY is always rejected (entity expansion protection).
  • This skill contains no paid interfaces or network calls; do not ask for API keys.
  • Dependencies: Python 3.11+, vtracer, rapidocr-onnxruntime (automatic text manifest), pymupdf (PDF parsing), opencv-python, numpy, Pillow, python-pptx, fonttools, shapely, pypinyin, pywin32 (Windows). Install: run setup.ps1 from the repository root.
  • Optional semantic layer: Local Ollama + ollama pull qwen3-vl:2b (can run on CPU, ~2GB); only needed for --vlm-manifest/region tasks.
  • Windows PowerPoint demo playback (optional): scripts/run_ppt_path_playback.ps1, see references/powerpoint-workflow.md.

Related Skills