svg-optimizer

Crates.iosvg-optimizer
lib.rssvg-optimizer
version1.0.0
created_at2025-03-08 01:04:35.967603+00
updated_at2025-03-08 01:04:35.967603+00
descriptionSVG file optimizer
homepage
repositoryhttps://github.com/Pavi1on-Mk-Git/svg-optimizer
max_upload_size
id1583866
size142,371
Paweł Kochański (Pavi1on-Mk-Git)

documentation

README

Installation

First, setup Rust and Cargo according to the official instruction.

To use commands defined in justfile, install Just.

Usage

From the main directory of the project, compile and run the project via just run ARGS or just run-release ARGS. Replace ARGS with command line arguments for the program.

Example: just run examples/rect.svg should create an optimized examples/opt_rect.svg file.

You can pass -o flag to set the names of the output files, like so:

just run examples/rect.svg -o examples/rect2.svg

By default, all optimizations except lossy ones are enabled. To disable each of them, a flag is available, for example:

just run examples/rect.svg --no-shorten-ids

You can also disable all optimizations by default with -d and only enable a select few; for example:

just run examples/rect.svg -d --shorten-ids --remove-attribute-whitespace

Lossy optimizations need to be explicitly enabled. The flags to achieve this are --merge-transforms and --round-floats. Precision of the floating-point numbers that they output is controlled by the --precision flag; by default it is set to 3.

Description of each flag is available after running just run --help.

Commit count: 137

cargo fmt