Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image to Editable PPTX

Convert a single image into an editable PowerPoint slide.

This is a general-purpose image-to-editable-PPTX tool, not a screenshot wrapper. It rebuilds the slide as editable objects:

  • background shape
  • card / white panel shapes
  • cropped image block
  • editable text boxes from source layout JSON or OCR
  • a layout.json sidecar for debugging and future tuning

Requirements

  • Python 3.9+
  • Pillow
  • python-pptx
  • rapidocr-onnxruntime for the default OCR path
  • macOS Swift/Vision is optional and only used as a fallback backend

Install Python dependencies:

python3 -m pip install -r requirements.txt

Usage

python3 image_to_editable_pptx.py /path/to/input.jpg -o /path/to/output.pptx

This command works on a standalone image. If you also have a structured layout JSON from another design/export system, you can pass it explicitly for a higher-fidelity reconstruction:

python3 image_to_editable_pptx.py /path/to/input.jpg \
  --source-layout /path/to/layout.json \
  -o /path/to/output.pptx

When no source layout JSON is provided, the tool falls back to image analysis and writes a sidecar layout file:

output.layout.json

How It Works

Mode A: layout-assisted reconstruction

  1. Reads the source layout JSON.
  2. Converts JSON shape elements to editable PowerPoint shapes.
  3. Decodes JSON image elements into PowerPoint picture objects.
  4. Converts JSON text elements into editable text boxes while preserving text, font size, color, alignment, bold, and italic when those styles exist.

Mode B: image-only reconstruction

  1. Samples the image corners to infer the slide background color.
  2. Detects the dominant content card by finding pixels that differ from the background.
  3. Finds the bright header panel inside the card.
  4. Treats the lower card area as the hero image block and crops it into an editable picture object.
  5. Runs OCR with RapidOCR as the primary backend.
  6. Falls back to a native macOS Vision helper if RapidOCR is unavailable.
  7. Re-runs OCR on focused regions such as the white panel to improve small-text stability.
  8. Repairs common OCR issues such as collapsed CamelCase spaces.
  9. Infers text color, approximate font size, font family, alignment, boldness, and multiline grouping from the original image.
  10. Uses an automatic render strategy:
    • if card/panel/image-block structure is reliable, rebuild with editable shapes
    • otherwise preserve the full image as slide base to keep layout stable
  11. Adds OCR text boxes as editable layers using python-pptx.

What Improved

Compared with the previous version:

  • OCR no longer depends on a single Swift script path.
  • Default OCR is more stable on real images because it uses a dedicated OCR model backend.
  • Text boxes now preserve more style information in image-only mode.
  • Source-layout mode also keeps font-weight and font-style when present.
  • The generated layout.json records the OCR backend that produced the result.

Scope

This project is intentionally generic, but the current heuristics are tuned for clean title slides and cover pages. It is designed to be extensible, not magically perfect for arbitrary complex posters.

Good fits:

  • minimal cover pages
  • title cards
  • image + text hero layouts
  • clean business slides

Poor fits:

  • dense infographics
  • highly decorative posters
  • screenshots with many tiny UI labels
  • layouts requiring exact font identification from pixels alone

What You Should Expect

If you clone this repository locally and run it with a single image:

  • it will generate a .pptx
  • that .pptx will contain editable PowerPoint objects, not just one flat screenshot
  • the output quality depends on layout complexity
  • simple business cover slides should now be materially more stable than the previous OCR-first draft

For complex designs, treat the generated PPTX as a structured starting point, not a perfect reproduction.

About

AI-powered tool that converts design images into editable PowerPoint slides

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages