A Rust CLI tool that watches a folder for .svg file changes and automatically converts them to .png files using the resvg rendering engine.
- File Watching: Monitors a specified directory for new or modified SVG files.
- Automatic Conversion: Instantly converts detected SVGs to PNG format.
- Batch Processing: Optional flag to convert all existing SVGs on startup.
- Cross-Platform: Works on Windows, macOS, and Linux.
Ensure you have Rust installed. Then, clone the repository and build the project:
git clone https://github.com/somenoe/svg-to-png-cli.git
cd svg-to-png-cli
cargo build --releaseRun the tool using cargo run or the built binary.
# Basic usage (watches current directory, outputs to ./out)
cargo run
# Specify input and output directories
cargo run -- --input ./svgs --output ./pngs
# Convert existing files on startup
cargo run -- --input ./svgs --output ./pngs --convert-existing-i, --input <DIR>: Input folder to watch for SVG files (default:.)-o, --output <DIR>: Output folder for PNG files (default:out)-e, --convert-existing: Convert all existing SVG files on startup (default:false)-n, --no-watch: One-time conversion without watching (no file watcher)-v, --version: Print version information
- clap - Command-line argument parsing
- notify - File system notification
- resvg - SVG rendering
- fontdb - Font database for text rendering
- anyhow - Error handling
- usvg - SVG parsing
- tiny-skia - 2D graphics library
This project is licensed under the MIT License. See the LICENSE file for details.