CLI Quick Start
Install
Section titled “Install”From source (Rust 1.82+)
Section titled “From source (Rust 1.82+)”cargo install --path .Local development
Section titled “Local development”cargo run -- convert examples/test_logo_benchmark.png out.svgCommands
Section titled “Commands”| Command | Purpose |
|---|---|
convert | Default single-image conversion |
logo | Logo and icon oriented conversion (clean paths) |
premium | Higher-fidelity conversion for richer images |
auto | Let EdgeSVG choose the method |
smart | Iterative search under quality and size constraints |
info | Quick recommendation for an input |
analyze | Raw image features and classification |
compare | Quantify SVG quality against source raster |
render | Produce a PNG preview from an SVG |
optimize | Round coordinates and remove SVG noise |
benchmark | Batch convert a raster directory |
benchmark-golden | Re-render golden SVG corpus and compare |
Examples
Section titled “Examples”Convert with auto mode
Section titled “Convert with auto mode”edgesvg convert logo.png logo.svg --method auto --jsonThe --json flag outputs a machine-readable JSON report with quality metrics:
{ "svg": "...", "requested_method": "Auto", "effective_method": "Logo", "fallback_from": null, "decision": "Detected as logo (monochrome, low unique colors)", "report": { "metrics": { "ssim": 0.9987, "edge_f1": 0.9423, "foreground_iou": 0.9812, "path_count": 3, "file_size": 1248 } }}Logo conversion
Section titled “Logo conversion”edgesvg logo icon.png icon.svg --jsonPremium high-fidelity
Section titled “Premium high-fidelity”edgesvg premium illustration.png illustration.svg --target 0.98 --jsonInspect an image
Section titled “Inspect an image”# Quick recommendationedgesvg info logo.png --json
# Raw image featuresedgesvg analyze logo.png --jsonCompare SVG quality
Section titled “Compare SVG quality”edgesvg compare logo.png logo.svg --jsonRender SVG to PNG
Section titled “Render SVG to PNG”edgesvg render logo.svg preview.png --width 512 --height 512Optimize an SVG
Section titled “Optimize an SVG”edgesvg optimize logo.svg --precision 2 --jsonBatch benchmark
Section titled “Batch benchmark”edgesvg benchmark \ --input-dir images/ \ --output-dir results/ \ --json-path results/report.json \ --markdown-path results/report.mdGolden benchmark
Section titled “Golden benchmark”Re-render golden SVG corpus into rasters and compare against the current engine:
edgesvg benchmark-golden --jsonJSON Output
Section titled “JSON Output”All commands support --json for machine-readable output. This is the recommended format for scripting:
# Pipe to jq for quick metric inspectionedgesvg convert logo.png logo.svg --method auto --json | jq '.report.metrics.ssim'
# Check if quality meets thresholdSSIM=$(edgesvg compare logo.png logo.svg --json | jq '.ssim')if (( $(echo "$SSIM < 0.99" | bc -l) )); then echo "Quality regression detected" exit 1fiCI/CD Integration
Section titled “CI/CD Integration”Add quality gates to your build pipeline:
- name: Vectorize assets run: | edgesvg convert assets/logo.png dist/logo.svg --method auto --json > report.json SSIM=$(jq '.report.metrics.ssim' report.json) python3 -c "import sys; sys.exit(0 if float('$SSIM') >= 0.98 else 1)"See the CI/CD guide for a complete example.