Svgy
Generate icons from SVG
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.svgmacos
example.icns16x16 to 1024x1024windows
example.ico16x16 to 256x256favicon.svg32x32
--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.svgexample.svgy.svg1024x1024example.svgy.png1024x1024
Put the artwork in a circle, for a round avatar:
svgy example.svg --round
example.svgexample.round.svg1024x1024
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 is1024.--suffix=<suffix>: Change the end of the file name. The default issvgy.--precision=<fraction>: Set the maximum change to the SVG image. The default is0.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
.icnsand.icofiles. - Optimization: How Svgy makes files smaller.
- Roadmap: Planned features.
Requirements
Rust, edition 2024.
License
Dual-licensed under either of
- Apache License, Version 2.0
- MIT License
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.