svgcleaner could help you to clean up your SVG files from the unnecessary data.
The main purpose of the svgcleaner is to losslessly reduce size of an SVG image, created in a vector editing application, before publishing.
Usually, more than half of an SVG image data is useless for rendering: - Temporary data used by the vector editing application. - Non-optimal SVG structure representation. - Unused and invisible graphical elements. - ...
There are only one real alternative to the svgcleaner - svgo.
Despite obvious advantages of the svgcleaner, like correctness, cleaning ratio and performance, which is shown bellow, there are some more nuances:
* You can get all of this features using GUI.
See 'Testing notes' for details.
Less is better.
* Yes, svgcleaner 0.6.2 is an absolute garbage on this data set.
More is better.
* And again, svgcleaner 0.6.2 is kinda superb, but since it breaks most of the files - it's pointless. Same goes for svgo.
Less is better.
You can find more tests, with detailed explanations of errors, here.
svgcleaner shouldn't change your file unless you say it to, but there are still things that can't be preserved. So even if you disable all cleaning options there are still things that will be changed:
style
element will be extracted and processes. The style
element will be removed.style
attribute will be split into attributes.class
attribute will be processed and removed.currentColor
and inherit
attributes values will be resolved.defs
element.offset
attribute value of the stop
element represented as percent - it will be
converted into number.You need the latest stable Rust compiler.
bash
cargo build --release
If you're a Rust programmer, you can install svgcleaner using:
bash
cargo install svgcleaner
svgcleaner in.svg out.svg
Use --help
for a list of the cleaning options and the doc for more details.
You can get a GUI here.
You can get prebuild packages here.
See CONTRIBUTING.md for details.
svgcleaner is licensed under the GPL-2.0.