How PPT Master Converts SVG to Native PowerPoint Shapes Instead of Embedding Images
PPT Master parses SVG markup and translates each vector element into native DrawingML XML that PowerPoint renders as editable shapes rather than static bitmap images.
PPT Master is an open-source tool that transforms SVG graphics into fully editable PowerPoint presentations. Unlike simple converters that embed SVG files as raster images, this repository implements a complete vector-to-vector translation pipeline. The system walks the SVG element tree and generates native DrawingML markup that preserves every shape, text block, and gradient as a manipulatable PowerPoint object.
The SVG-to-DrawingML Conversion Pipeline
The conversion process in drawingml_converter.py executes a multi-stage pipeline that maps SVG primitives to their Office Open XML equivalents.
Parse SVG Definitions and Build Reference Maps
First, the collect_defs() function scans the SVG's <defs> sections to build an ID-to-element mapping. This enables the converter to resolve gradients, clip-paths, filters, and symbols when they are referenced later in the document.
Source: [drawingml_converter.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py#L62-L78)
Establish Conversion Context with Inherited State
The ConvertContext class stores the current slide number, accumulated transforms, inherited CSS styles, and media file collections. When processing nested <g> (group) elements, the system spawns child contexts via ConvertContext.child() to ensure transforms compose correctly without mutating parent state.
Source: [drawingml_context.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_context.py#L18-L61)
Dispatch Elements to Specialized Converters
The convert_element dispatcher looks up each SVG tag in the _CONVERTERS registry and delegates to the appropriate handler. This table-driven approach allows the system to handle rectangles, circles, paths, text, and images through dedicated code paths.
Source: [drawingml_converter.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py#L79-L88)
Generate Native DrawingML for Vector Primitives
Each geometric primitive receives specialized handling:
- Rectangles, circles, ellipses, lines, polygons, and polylines — Dedicated
convert_*functions calculate EMU coordinates (English Metric Units), extract fill and stroke styles, resolve rotation transforms, and wrap the result in<p:sp>shape markup via_wrap_shape. - Paths — Complex vector paths convert to
<a:path>elements within DrawingML shapes while preserving Bezier curves. - Text — The
convert_textfunction creates<p:txBody>structures with rich text runs, preserving font families, sizes, colors, and alignment. - Groups — The
convert_gfunction produces<p:grpSp>containers that maintain hierarchy and flatten single-child groups for efficiency.
Source: [drawingml_elements.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py#L61-L101) and [drawingml_converter.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py#L61-L92)
Apply Filters, Opacity, and Visual Effects
After constructing base shapes, the converter checks for referenced SVG filters and CSS opacity values. The build_effect_xml function from drawingml_styles.py generates corresponding <a:effectLst> entries that render drop shadows, glows, and transparency natively in PowerPoint.
Source: [drawingml_elements.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py#L71-L80)
Assemble Final Slide Markup
The convert_svg_to_slide_shapes function orchestrates the entire process, concatenating individual shape XML fragments into a complete <p:sld> document. It returns the slide markup alongside collected media blobs and relationship entries required for the final package.
Source: [drawingml_converter.py](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py#L97-L124)
Practical Usage: Converting SVG Files to PPTX
You can invoke the conversion pipeline through the command-line interface:
python -m skills.ppt-master.scripts.svg_to_pptx.pptx_cli \
--svg path/to/diagram.svg \
--output ./output.pptx \
--verbose
Behind the scenes, the CLI calls the core conversion function:
from skills.ppt_master.scripts.svg_to_pptx.drawingml_converter import convert_svg_to_slide_shapes
from pathlib import Path
slide_xml, media_files, relationships = convert_svg_to_slide_shapes(
Path("diagram.svg"),
slide_num=1,
verbose=True
)
The pptx_builder.py module then packages the generated slide_xml, writes media files to ppt/media/, and creates the necessary relationship files in /ppt/_rels/. The resulting file contains native DrawingML shapes that support PowerPoint editing operations like resize, recolor, and ungroup—functionality impossible with embedded raster images.
Summary
- PPT Master translates SVG vector graphics into native DrawingML markup rather than embedding static images.
- The
collect_defs()function builds reference maps for gradients and filters before processing begins. ConvertContextmaintains state across nested group transformations through immutable child contexts.- Element-specific converters in
drawingml_elements.pyhandle rectangles, paths, text, and groups individually. - Final assembly occurs in
convert_svg_to_slide_shapes, producing editable<p:sp>shapes and<p:grpSp>groups. - Output files retain full PowerPoint editability, allowing users to manipulate colors, sizes, and positions after conversion.
Frequently Asked Questions
What is the difference between native PowerPoint shapes and embedded SVG images?
Native PowerPoint shapes are DrawingML objects stored as XML within the PPTX file that users can edit, recolor, resize, and ungroup. Embedded SVG images are typically converted to raster bitmaps (PNG/JPG) during insertion, resulting in static images that lose vector quality when scaled and cannot be edited as individual shape elements.
How does PPT Master handle complex SVG gradients and filters?
The system resolves gradients and filters during the definition collection phase via collect_defs(), then applies them through build_effect_xml in drawingml_styles.py. These translate to <a:gradFill> and <a:effectLst> elements in the DrawingML output, preserving visual fidelity while maintaining native editability.
Can I edit the converted shapes in PowerPoint after conversion?
Yes. Because PPT Master generates native <p:sp> (shapes), <p:txBody> (text), and <p:grpSp> (groups) elements rather than <p:pic> (pictures) for vector content, the resulting objects behave like manually created PowerPoint shapes. You can ungroup them, change fill colors, modify text, and apply PowerPoint animations without quality loss.
Which SVG elements are currently supported by the converter?
The converter supports rectangles, circles, ellipses, lines, polygons, polylines, paths, text elements, groups (<g>), and images. The _CONVERTERS dispatch table in drawingml_converter.py maps each SVG tag to its specific handler function, with path data and basic shapes receiving full vector translation while raster images within the SVG are handled as <p:pic> references.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →