semvec/pypi-packages huggingface dataset:
svg2pptx 1.0.3
Convert SVG files to native, editable PowerPoint shapes
License: MIT
Requires Python: >=3.9
Keywords: svg, powerpoint, pptx, converter, vector, graphics

# SVG to PowerPoint Shape Converter

A Python library that converts SVG (Scalable Vector Graphics) files into native, editable PowerPoint shapes. Unlike simple image embedding, this tool parses SVG elements and recreates them as true PowerPoint objects—rectangles become rectangles, lines become lines, and text becomes editable text boxes.

## Installation

```bash
pip install svg2pptx
```

Or install from source:

```bash
git clone https://github.com/benouinirachid/svg2pptx.git
cd svg2pptx
pip install -e ".[dev]"
```

## Quick Start

```python
from svg2pptx import svg_to_pptx

# Convert SVG file to PowerPoint
svg_to_pptx("icon.svg", "output.pptx")
```

## CLI Usage

You can also use the command-line interface to convert files:

```bash
svg2pptx input.svg output.pptx [options]
```

### Options

| Option | Description |
|--------|-------------|
| `--no-text` | Skip converting text elements |
| `--no-shapes` | Skip converting shape elements |
| `--scale <float>` | Scale factor for the SVG content (default: 1.0) |
| `--flatten` | Flatten groups into individual shapes (default) |
| `--no-flatten` | Preserve group structure from SVG |

### Examples

```bash
# Basic conversion
svg2pptx diagram.svg presentation.pptx

# Scale up by 2x and skip text
svg2pptx chart.svg slide.pptx --scale 2.0 --no-text
```

## Features

- **Editable shapes** — Resize, recolor, and modify individual elements directly in PowerPoint
- **Native formatting** — Apply PowerPoint styles, themes, and animations to converted shapes
- **Smaller file sizes** — Vector shapes are lighter than embedded raster images
- **Preservation of structure** — Maintain layers, groups, and object hierarchy from your original design

## Supported SVG Elements

| Element | Support |
|---------|---------|
| `<rect>` | ✅ Full |
| `<circle>` | ✅ Full |
| `<ellipse>` | ✅ Full |
| `<line>` | ✅ Full |
| `<polygon>` | ✅ Full |
| `<polyline>` | ✅ Full |
| `<path>` | ✅ Approximated curves |
| `<g>` (groups) | ✅ Full |
| `<text>` | ✅ Basic |

## Configuration

```python
from svg2pptx import svg_to_pptx, Config

config = Config(
    scale=2.0,                  # Scale factor for SVG content
    curve_tolerance=0.5,        # Curve approximation quality (lower = more accurate)
    preserve_groups=True,       # Maintain SVG group structure
)

svg_to_pptx("diagram.svg", "output.pptx", config=config)
```

## Advanced Usage

```python
from svg2pptx import SVGConverter
from pptx import Presentation

# Add SVG shapes to an existing presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6])  # Blank layout

converter = SVGConverter()
converter.add_to_slide("icon.svg", slide)

prs.save("combined.pptx")
```

## Limitations

- **Bezier curves** are approximated with line segments (configurable tolerance)
- **Gradients** are not supported (will use first color)
- **Filters and effects** (blur, drop shadow) are not supported
- **CSS external stylesheets** are not supported

## License

MIT License
simple-video-utils 0.0.4
Shared utilities for processing videos for sign language.
License: MIT
Requires Python: >=3.8

# Simple Video Utils

Lightweight utilities for extracting frames and metadata from videos. Built for sign language processing workflows.

![Python](https://img.shields.io/badge/python-3.10+-blue)
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)

## Goal

Provide simple, efficient tools for video processing in sign language research and applications. 
Uses PyAV for fast frame extraction with support for multiple formats (MP4, WebM) and remote URLs.

## Installation

```bash
pip install simple-video-utils
```

## Usage

### Extract Video Metadata

```python
from simple_video_utils.metadata import video_metadata

meta = video_metadata("video.mp4")
print(f"{meta.width}x{meta.height} @ {meta.fps} fps")
# Output: VideoMetadata(width=1920, height=1080, fps=30.0, nb_frames=450, time_base='1/15360')
```

### Read Frames from File

```python
from simple_video_utils.frames import read_frames_exact

# Read specific frame range (inclusive)
frames = list(read_frames_exact("video.mp4", start_frame=0, end_frame=10))
# Returns 11 frames as numpy arrays (H, W, 3) in RGB format

# Read from frame to end of video
frames = list(read_frames_exact("video.mp4", start_frame=5, end_frame=None))
```

### Read Frames from Stream

```python
from simple_video_utils.frames import read_frames_from_stream

# Useful for uploaded files or in-memory video data
with open("video.mp4", "rb") as f:
    meta, frames_gen = read_frames_from_stream(f)
    for frame in frames_gen:
        # Process each frame (numpy array)
        pass
```

### Remote Videos

```python
from simple_video_utils.metadata import video_metadata
from simple_video_utils.frames import read_frames_exact

# Works with remote URLs
url = "https://example.com/video.mp4"
meta = video_metadata(url)
frames = list(read_frames_exact(url, 0, 5))
```

## Development

```bash
pip install -e ".[dev]"
pytest tests/
ruff check .
```