A modern web application that converts raster images (PNG, JPG/JPEG, WebP, BMP, GIF) to true vector SVG format using VTracer. Built with Svelte for the frontend and FastAPI for the backend, this tool provides real-time conversion progress tracking and comprehensive error handling.
https://github.com/fightingsou/png-to-svg/assets/104222305/a33c68de-1575-42ab-b524-ecc5016f263c
Clone the repository
git clone https://github.com/sserada/image-to-svg.git
cd image-to-svg
Configure environment variables
Copy the sample environment file:
mv sample.env .env
Edit .env file
Configure the following variables:
IP=0.0.0.0 # Server IP address (use 0.0.0.0 for all interfaces)
FRONTEND_PORT=55030 # Frontend port (default: 55030)
BACKEND_PORT=55031 # Backend API port (default: 55031)
Note: You can find your local IP address using
ip a(Linux) orifconfig(macOS).
Start the application
docker compose up -d
This will:
Access the application
Open your browser and navigate to:
http://{IP}:{FRONTEND_PORT}
For example, if using default settings on localhost:
http://localhost:55030
docker compose down
Container fails to start:
# Check logs
docker compose logs its-backend
docker compose logs its-frontend
# Rebuild containers
docker compose down
docker compose build --no-cache
docker compose up -d
File conversion fails:
Port already in use:
FRONTEND_PORT or BACKEND_PORT in .envGET /backend/health
Returns {"status": "healthy"} when the backend is running.
POST /backend/upload/{request_id}
request_id (path): UUID v4 format string{"name": "image.png", "data": "data:image/png;base64,...", "preset": "balanced"}preset (optional): One of high_quality, balanced (default), fast{"success": true, "url": "...", "filename": "image.svg"}GET /backend/presets
Returns available conversion presets and their parameters:
{
"high_quality": {"color_precision": 8, "filter_speckle": 2, ...},
"balanced": {"color_precision": 6, "filter_speckle": 4, ...},
"fast": {"color_precision": 4, "filter_speckle": 8, ...}
}
GET /backend/download/{request_id}
Returns the converted SVG file for the given request ID.
Visit http://localhost:55031/api/docs for the Swagger UI.
cd backend
pip install -r requirements-dev.txt
uvicorn main:app --host 0.0.0.0 --port 55031 --reload
cd frontend
npm install
npm run dev -- --host 0.0.0.0 --port 55030
# Backend
cd backend
python -m pytest tests/ -v
# Frontend
cd frontend
npm run test
Q: What is the maximum file size? A: 10MB per image.
Q: Can I convert multiple files at once? A: Yes, select multiple files in the upload dialog. They are processed sequentially.
Q: How long are converted files stored? A: Files are automatically deleted after 1 hour.
Q: What conversion parameters does VTracer use?
A: Three presets are available — High Quality, Balanced, and Fast. Each adjusts color precision, speckle filtering, and iteration count. Use the preset selector in the UI or the preset parameter in the API. See backend/main.py for exact values.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is open source and available under the MIT License.
Last Updated: 2026-03-11 Maintainer: sserada