ts-figure-optimize

Convert raster scientific figures into editable hybrid SVG, PDF, and PPTX files.

1.1k|19|Updated Jun 18, 2026
One-click install
npx skills add https://github.com/Spark-To-Paper-Skills/spark-to-paper-skills --skill ts-figure-optimize-spark-to-paper-skills
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ts-figure-optimize
Source: https://github.com/Spark-To-Paper-Skills/spark-to-paper-skills/tree/main/skills/ts-figure-optimize
Command: npx skills add https://github.com/Spark-To-Paper-Skills/spark-to-paper-skills --skill ts-figure-optimize-spark-to-paper-skills

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, Pillow, python-pptx, cairosvg, openai, and includes scripts (resource) and references (resource) components.

What problem does it solve? Raster figures generated by image models (e.g., gpt-image schematics) cannot be edited: labels, subscripts, and text are baked into pixels. This Skill converts a single PNG/JPG figure into a publication-ready artifact where the graphics stay pixel-exact while every text label becomes a genuinely editable text element. ## Core Features & Use Cases - Key-free hybrid vectorization: Local perception (SAM3 region detection + PaddleOCR + Box-IR layout) followed by a deterministic build that keeps the approved render pixel-exact and overlays editable text, exported as self-contained SVG, vector PDF, and editable PPTX (~0.91 SSIM). - GPT-vision text correction: Per-region transcription fixes OCR-dropped subscripts and casing, rendered as real baseline-shifted sub/superscript runs. - Measured quality gates: SSIM/region/OCR scoring, editability verification, and honest stop conditions (PASS / REVIEW_REQUIRED / FAILED) with mandatory human approval. - Use Case: You have an approved method-overview schematic PNG for a paper. Run the hybrid pipeline to get an editable SVG/PDF/PPTX where reviewers can fix labels, while the figure's visual richness is preserved exactly. ## Quick Start Convert my approved figure schematic.png into an editable hybrid SVG, PDF, and PPTX using the key-free DrawAI pipeline.

Frequently Asked Questions about ts-figure-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert a PNG figure into an editable PPTX?▼

Run scripts/run_hybrid.py with --image pointing to your PNG and a --run-name. It performs local SAM3 segmentation and OCR, then builds a PPTX with the pixel-exact graphic as background and every label as an editable text box, plus SVG and PDF exports.

What is the difference between hybrid export and full vector redraw?▼

Hybrid keeps the original render pixel-exact as a raster and overlays editable text, reaching about 0.91 SSIM. The legacy full vector redraw recreates every element as vectors but drops to roughly 0.67 SSIM on dense figures and requires a Codex account, so hybrid is the default.

Does the hybrid pipeline require an OpenAI API key or HF token?▼

No. The hybrid path is key-free: models (SAM3, PaddleOCR, RMBG) download from ModelScope without gating, and perception runs locally. Keys are only needed for the optional GPT text-correction step or the legacy Codex redraw.

Can I edit the graphics themselves after conversion?▼

No. In the hybrid output only text is editable; graphics remain a pixel-exact raster. This is an explicit trade-off: re-typed text caps fidelity around 0.90 SSIM, and a fully vector-editable redraw loses more fidelity on dense figures.

Why does my converted figure have text offset or duplication?▼

Text offset occurs when OCR bounding boxes are not scaled from the Box-IR canvas space to the actual source pixel resolution. The build script applies this scale automatically; ensure ocr_boxes.json and box_ir.json come from the same DrawAI run.

What happens if the DrawAI runtime cannot be provisioned?▼

The caller keeps the approved PNG as-is with no conversion attempted. There is no lightweight redraw fallback, because a lossy redraw of a dense figure produces worse fidelity than keeping the original raster.