Skip to content

CLI Quick Start

Terminal window
cargo install --path .
Terminal window
cargo run -- convert examples/test_logo_benchmark.png out.svg
CommandPurpose
convertDefault single-image conversion
logoLogo and icon oriented conversion (clean paths)
premiumHigher-fidelity conversion for richer images
autoLet EdgeSVG choose the method
smartIterative search under quality and size constraints
infoQuick recommendation for an input
analyzeRaw image features and classification
compareQuantify SVG quality against source raster
renderProduce a PNG preview from an SVG
optimizeRound coordinates and remove SVG noise
benchmarkBatch convert a raster directory
benchmark-goldenRe-render golden SVG corpus and compare
Terminal window
edgesvg convert logo.png logo.svg --method auto --json

The --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
}
}
}
Terminal window
edgesvg logo icon.png icon.svg --json
Terminal window
edgesvg premium illustration.png illustration.svg --target 0.98 --json
Terminal window
# Quick recommendation
edgesvg info logo.png --json
# Raw image features
edgesvg analyze logo.png --json
Terminal window
edgesvg compare logo.png logo.svg --json
Terminal window
edgesvg render logo.svg preview.png --width 512 --height 512
Terminal window
edgesvg optimize logo.svg --precision 2 --json
Terminal window
edgesvg benchmark \
--input-dir images/ \
--output-dir results/ \
--json-path results/report.json \
--markdown-path results/report.md

Re-render golden SVG corpus into rasters and compare against the current engine:

Terminal window
edgesvg benchmark-golden --json

All commands support --json for machine-readable output. This is the recommended format for scripting:

Terminal window
# Pipe to jq for quick metric inspection
edgesvg convert logo.png logo.svg --method auto --json | jq '.report.metrics.ssim'
# Check if quality meets threshold
SSIM=$(edgesvg compare logo.png logo.svg --json | jq '.ssim')
if (( $(echo "$SSIM < 0.99" | bc -l) )); then
echo "Quality regression detected"
exit 1
fi

Add quality gates to your build pipeline:

.github/workflows/vectorize.yml
- 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.