dqev/rustorizer
Über uns
Rust based PNG to SVG Vectorizer
Weitere ProjekteGemessener Sternzuwachs
- in 24h
- +15
- in 7 days
- Verlauf wird gesammelt
- in 15 days
- Verlauf wird gesammelt
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original
Turn images into clean, editable SVG files.
Rustorizer is written in Rust. You can use it from the terminal, in your browser, or as an HTTP API. The same input and settings are designed to give the same output (it is deterministic).
Input: PNG, JPEG, WebP, BMP, GIF
Output: SVG
Contents
Install
Beginner install
No Rust yet? No problem. This one command installs Rust if needed, builds Rustorizer, installs the
rustorizer command, and adds it to your PATH.
git clone https://github.com/dqev/rustorizer.git
cd rustorizer
./install.sh
Open a new terminal when it finishes, then start the app:
rustorizer ui
Advanced setup
You need Rust and Cargo.
./setup.sh
This builds the project and installs the rustorizer command into ~/.cargo/bin. It also adds Cargo's
bin directory to your shell profile (.zshrc or .bashrc) if it isn't already there, so the command
works in new terminals.
Restart your terminal, or reload your profile, after setup:
source ~/.zshrc # zsh
source ~/.bashrc # bash
If you still see rustorizer: command not found, run ~/.cargo/bin/rustorizer directly or add
export PATH="$HOME/.cargo/bin:$PATH" to your shell profile.
Then convert your first image (replace logo.png with your file):
rustorizer logo.png
The result is saved as logo.svg.
Setup options
| Command | What it does |
|---|---|
./install.sh |
Simple install: Rust, build, install, PATH |
./setup.sh |
Build and install |
./setup.sh --test |
Run all tests and benchmarks |
./setup.sh --ui |
Build, install, and start the web app at 127.0.0.1:8080 |
./setup.sh --no-install |
Build only |
./setup.sh --no-path |
Install without editing your shell profile |
If you use --no-install, run ./target/release/rustorizer instead of rustorizer.
Command line
Basic use
rustorizer logo.png # saves logo.svg
rustorizer logo.png clean.svg # saves clean.svg
Presets
Pick the preset that matches your image.
| Preset | Command |
|---|---|
| Clipart | rustorizer icon.png --preset clipart |
| Gradient | rustorizer icon.png --preset gradient |
| Photo | rustorizer photo.jpg --preset photo |
| Line art | rustorizer sketch.png --preset line |
Other options
| Task | Command |
|---|---|
| Remove the background | rustorizer sprite.png --remove-background |
| Use the no-overlap algorithm | rustorizer icon.png --algorithm no-overlap |
| Debug with X-ray mode | rustorizer shape.png --debug-xray |
Browser app
Option A: Static Browser WASM (Zero server)
Convert images completely inside the visitor's browser via WebAssembly (web/studio/):
./wasm/build.sh
./wasm/serve.sh
Then open http://127.0.0.1:8080/studio/ (or deploy web/ to any static host such as Cloudflare Pages, Vercel, or GitHub Pages).
Option B: Local Native Server (rustorizer ui)
Start the native local web server:
rustorizer ui
Then open:
- Website: http://127.0.0.1:8080
- Studio (native
/v1/vectorize): http://127.0.0.1:8080/studio
Self-hosting
With Docker
Run this inside the cloned rustorizer folder:
docker compose up -d --build
Open http://localhost:8080.
To use a different port, such as 3000:
RUSTORIZER_PORT=3000 docker compose up -d
Without Docker
Build and run the API server:
cargo build --release --workspace
VECTOR_API_BIND=0.0.0.0:8080 ./target/release/vector-api
Or, if you installed the command line tool:
rustorizer ui --host 0.0.0.0 --port 8080
vector-api chooses its address in this order:
VECTOR_API_BINDPORT(listens on0.0.0.0:$PORT)127.0.0.1:8080(default)
Custom domain
Example Caddyfile for Caddy as a reverse proxy:
vector.yourdomain.com {
reverse_proxy 127.0.0.1:8080
}
HTTP API
| Method | Route | Purpose |
|---|---|---|
GET |
/ |
Website |
GET |
/studio |
Browser app |
GET |
/health |
Health check |
POST |
/v1/vectorize |
Convert an uploaded file |
POST |
/v1/vectorize/json |
Convert a base64 image |
POST |
/v1/palettes |
Get color palette suggestions |
The upload and JSON body limit is 20 MB. CORS is enabled.
Health check
curl http://127.0.0.1:8080/health
{"status":"ok","version":"0.1.0"}
Convert a file
Send multipart/form-data with a file field. The options field (JSON) is optional.
curl http://127.0.0.1:8080/v1/vectorize \
-F "[email protected]" \
-F 'options={"algorithm":"overlap","format":"svg"}'
Convert a base64 image
POST /v1/vectorize/json
{
"image_base64": "<base64 or data URI>",
"options": {
"algorithm": "overlap",
"format": "svg"
}
}
Get color palettes
POST /v1/palettes
{
"image_base64": "<base64 or data URI>",
"counts": [4, 8, 12]
}
How it works
- Traces the actual pixels. It does not use generative AI to guess shapes.
- Avoids hairline gaps. Neighboring colors share the same boundary points.
- Cleans up soft edges. Anti-aliased pixels are resolved using a Markov random field (MRF).
- Keeps gradients smooth. It detects gradual color changes and rebuilds them as SVG gradients, using masks and blur for multi-color shading.
- Uses simple shapes. Round shapes can become a single
<circle>, and triangles and rectangles snap to straight lines.
Project layout
rustorizer/
engine/ Core library (vector-core)
src/pipeline/ Color reduction, denoising, preprocessing, config
src/geometry/ Topology, smoothing, curve and circle fitting, centerlines
src/render/ Layers, gradient meshes, SVG output
tests/ Integration and benchmark tests
services/
api/ HTTP API (vector-api, built with Axum)
cli/ Command line and benchmark tool
web/ Website and Studio (no build step)
docs/ Architecture notes
License
Ähnliche Projekte entdecken
Wird geladen…