1 unstable release
Uses new Rust 2024
| 0.1.0 | Dec 29, 2025 |
|---|
#1662 in Command line utilities
17KB
250 lines
SVG to PNG
A Rust CLI tool that watches a folder for .svg file changes and automatically converts them to .png files using the resvg rendering engine.
Features
- 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.
Installation
Ensure you have Rust installed. Then, clone the repository and build the project:
git clone <repository-url>
cd svg-to-png
cargo build --release
Usage
Run 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
Command Line Arguments
-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
Dependencies
- 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
License
This project is licensed under the MIT License. See the LICENSE file for details.
Dependencies
~7–17MB
~200K SLoC