name: ppt-edit
description: PPT图片转可编辑文字 — OCR识别PPT中图片内的文字,修复原图并叠加可编辑文本框,保留原始视觉样式。Use when the user wants to make text in PPT images editable, extract text from PPT images, or convert image-locked PPT text into editable textboxes. Triggers: "ppt-edit", "PPT可编辑", "图片文字转文本框", "OCR PPT", "make PPT editable", "extract text from PPT images".
ppt-edit — PPT Image Text → Editable Textboxes
Convert image-embedded text in PowerPoint files into editable text boxes, preserving the original visual design (arrows, shapes, borders, colors, fonts).
When to Use
- User has a PPT where text is baked into images (screenshots, diagrams, architecture blueprints)
- User wants to edit/translate/modify text that currently only exists as pixels in images
- User says "make this PPT editable", "图片里的文字不能改", "OCR这个PPT", etc.
How It Works
- OCR — Extract text + bounding boxes from each image using RapidOCR
- Color sampling — Detect background color (outside text box) and text color (inside)
- Inpaint — Fill text regions with background color, erasing text but keeping arrows/shapes/borders
- Replace image — Swap original image with inpainted version (preserves z-order)
- Overlay textboxes — Add transparent-background editable text boxes at original positions with correct font size and color
Output: <input>_editable.pptx
Usage
python ppt_ocr_edit.py <input.pptx>
Also supports .ppt files (auto-converts via LibreOffice if available).
Dependencies
python-pptx
Pillow
numpy
rapidocr_onnxruntime
Install all at once:
pip install python-pptx Pillow numpy rapidocr_onnxruntime
What Gets Preserved
- Slide layout and master
- Image z-order (textboxes overlay on top of inpainted image)
- Non-text visual elements (arrows, connectors, shapes, borders, gradients)
- Text position, font size, and color
- Bold heuristic for short large-font text (likely titles)
小葱技能站7w4.net发现了升级插件。
Limitations
- OCR accuracy depends on image quality and font clarity
- Font size estimation uses binary search with system CJK font; may be slightly off for non-standard fonts
- Background color sampling uses a 4px border ring; may be inaccurate for text on gradients
- Text on top of other text (overlapping OCR boxes) may produce visual artifacts
- No italic/underline detection — only bold is heuristically applied
File Structure
ppt-edit/
├── SKILL.md ← this file
├── ppt_ocr_edit.py ← core script
└── requirements.txt ← Python dependencies