svg-to-png-cli

Crates.iosvg-to-png-cli
lib.rssvg-to-png-cli
version0.1.0
created_at2025-12-29 03:27:22.878857+00
updated_at2025-12-29 03:27:22.878857+00
descriptionA CLI tool that auto-converts SVG files to PNG on file changes
homepage
repositoryhttps://github.com/somenoe/svg-to-png
max_upload_size
id2009904
size60,557
Pridsadang Pansiri (somenoe)

documentation

README

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.

Commit count: 0

cargo fmt