svgy 0.7.0

Convert an SVG to optimized icons for all platforms
svgy-0.7.0 is not a library.

Svgy

Generate icons from SVG

Build Status Crates.io docs.rs

Make all the icons of a project from one SVG, in one pass: optimized .svg, .png, Windows .ico, and macOS .icns.

Install

Install a signed binary for Linux, macOS, or Windows, on x64 or arm64:

cargo binstall svgy

Or build from crates.io:

cargo install svgy

Usage

svgy <input.svg> [targets] [options]

Use a square SVG for the best result.

Defaults

svgy file.svg makes file.svgy.svg.

Svgy:

  • Makes the image fit in 1024 x 1024.
  • Puts the artwork in the center of a square.
  • Makes the SVG smaller with oxvg.
  • Optimizes further while keeping visual changes below 2%.

This is the same as:

svgy file.svg --svg --suffix=svgy --size=1024 --precision=0.02

Examples

Make a macOS icon, a Windows icon, and a small SVG favicon:

svgy example.svg --icns=macos/example.icns --ico=windows/example.ico --svg=favicon.svg --size=32
  • example.svg
  • macos
    • example.icns 16x16 to 1024x1024
  • windows
    • example.ico 16x16 to 256x256
  • favicon.svg 32x32

--size has no effect on icons since they always have the same sizes.

Make a PNG and an SVG:

svgy example.svg --png --svg
  • example.svg
  • example.svgy.svg 1024x1024
  • example.svgy.png 1024x1024

Put the artwork in a circle, for a round avatar:

svgy example.svg --round
  • example.svg
  • example.round.svg 1024x1024

Main options

  • --svg, --png, --ico, --icns, --round: Select the files to make, add =<path> for the destination.
  • --size=<pixels>: Make the image fit in a square. The default is 1024.
  • --suffix=<suffix>: Change the end of the file name. The default is svgy.
  • --precision=<fraction>: Set the maximum change to the SVG image. The default is 0.02.
  • --no-optimize: Do not make the files smaller. Svgy is then much faster.

Refer to Options for all options.

Documentation

  • Options: All targets and options.
  • Behavior: Steps, text, images, files, and exit codes.
  • Formats: The images in the .icns and .ico files.
  • Optimization: How Svgy makes files smaller.
  • Roadmap: Planned features.

Requirements

Rust, edition 2024.

License

Dual-licensed under either of

at your option.

Unless you state otherwise, any contribution intentionally submitted for inclusion in svgy, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.