File size: 1,666 Bytes
7378664
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bb16d68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Any2SVG
emoji: 🎨
colorFrom: purple
colorTo: blue
sdk: gradio
sdk_version: 5.6.0
app_file: app.py
pinned: false
license: mit
short_description: Convert raster images to SVG vector graphics
tags:
  - image-processing
  - svg
  - vectorization
  - mcp-server
---

# Any2SVG - Image to SVG Vectorization Tool

A Gradio 6 application that converts raster images (PNG, JPG, WebP, etc.) to SVG vector graphics. Deployable as a Hugging Face Space and usable as an MCP server.

## Features

- **Multi-format Support**: Accepts PNG, JPG, JPEG, WebP, BMP, GIF, TIFF
- **High-Quality Vectorization**: Uses vtracer for professional-grade conversion
- **Configurable Parameters**: Control color mode, path precision, and more
- **MCP Server Ready**: Built-in MCP server support for AI agent integration
- **Output Directory Support**: Save SVGs to a configurable output directory

## Installation

```bash
cd any-to-svg
pip install -r requirements.txt
```

## Usage

### As a Web Application

```bash
python app.py
```

### As an MCP Server

The app automatically exposes an MCP endpoint at:
```
http://localhost:7860/gradio_api/mcp/sse
```

Add to your MCP client config:
```json
{
  "mcpServers": {
    "any2svg": {
      "url": "http://localhost:7860/gradio_api/mcp/sse"
    }
  }
}
```

### Environment Variables

- `SVG_OUTPUT_DIR`: Directory to save generated SVG files (default: `./output`)
- `GRADIO_MCP_SERVER`: Set to `true` to enable MCP server mode

## Deployment to Hugging Face Spaces

1. Create a new Space on Hugging Face
2. Upload all files from this directory
3. The Space will automatically start as both a web app and MCP server

## License

MIT