=========================
.. |build status| image:: https://travis-ci.org/RazrFalcon/svgcleaner.svg?branch=master :target: https://travis-ci.org/RazrFalcon/svgcleaner
svgcleaner helps you clean up your SVG files, keeping them free from unnecessary data.
|
.. contents:: Table of Contents
The main purpose of svgcleaner is to losslessly reduce the size of an SVG image, created in a vector editing application, before publishing.
Usually more than half of an SVG image's data is useless for rendering. For example:
... Are all unnecessary in a published SVG.
.. _svgo: https://github.com/svg/svgo .. _scour: https://github.com/scour-project/scour
In addition to the main advantages of svgcleaner — like correctness, cleaning ratio and performance, which are described below — there are some more nuances to be aware of:
It doesn't process directories. It doesn't do anything else. Just one task*.
* You can get all of these features using the GUI <https://github.com/RazrFalcon/svgcleaner-gui>
_.
See Testing notes <docs/testing_notes.rst>
_ for details.
All stats were collected using the latest release version.
Correctness ```````````
Less is better.
.. image:: docs/images/correctnesschartW3CSVG11_TestSuite.svg
.. image:: docs/images/correctnesschartoxygen.svg
Cleaning ratio ``````````````
More is better.
.. image:: docs/images/ratiochartW3CSVG11_TestSuite.svg
* scour_ creates bigger files (-18.78%).
.. image:: docs/images/ratiochartoxygen.svg
Cleaning time `````````````
Less is better.
.. image:: docs/images/performancechartW3CSVG11_TestSuite.svg
.. image:: docs/images/performancechartoxygen.svg
Other `````
========================= ================= ================ =========
Collection Size Before (MiB) Size After (MiB) Ratio (%)
========================= ================= ================ =========
Breeze icons theme
_ 21.72 11.09 48.91
Ardis icons theme
_ 11.82 5.23 55.74
Humanity icons theme
_ 8.56 3.08 64.01
Open Icon Library
_ 207.45 69.44 66.53
Elementary icons theme
_ 17.72 7.09 59.95
Adwaita icons theme
_ 2.21 0.37 83.08
Faience icon theme
_ 22.35 11.14 50.16
GCP Icons
_ 0.344 0.082 75.9
========================= ================= ================ =========
.. Breeze icons theme
: https://github.com/KDE/breeze-icons
.. _Ardis icons theme
: https://github.com/NitruxSA/ardis-icon-theme
.. _Humanity icons theme
: https://wiki.ubuntu.com/Artwork/Incoming/Karmic/HumanityIcons?action=AttachFile&do=view&target=humanity_2.1.tar.gz
.. _Open Icon Library
: https://sourceforge.net/projects/openiconlibrary
.. _Elementary icons theme
: https://github.com/elementary/icons
.. _Adwaita icons theme
: https://github.com/GNOME/adwaita-icon-theme
.. _Faience icon theme
: https://www.archlinux.org/packages/community/any/faience-icon-theme/
.. _GCP Icons
: https://cloud.google.com/icons/files/gcp-icons.zip
Documentation can be found here <docs/svgcleaner.rst>
_.
svgcleaner shouldn't change your file unless you tell 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, such as:
style
element will be extracted and processes. The style
element will be removed.style
attribute will be split into attributesclass
attribute will be processed and removedcurrentColor
and inherit
attributes values will be resolveddefs
elementoffset
attribute value of the stop
element is represented as percentage - it will be
converted into a decimal numberCLI ```
::
svgcleaner in.svg out.svg
Change default options:
::
svgcleaner --indent=2 --paths-coordinates-precision=5 --join-arcto-flags=yes in.svg out.svg
Use --help
for a list of the cleaning options and see the
documentation <docs/svgcleaner.rst>
_ for more details.
GUI ```
You can get a GUI here <https://github.com/RazrFalcon/svgcleaner-gui>
_.
You can get prebuilt packages here <https://github.com/RazrFalcon/svgcleaner-gui/releases>
_.
Dependency: Rust <https://www.rust-lang.org/>
_ >= 1.20
::
cargo build --release
If you're a Rust programmer, you can install svgcleaner using:
::
cargo install svgcleaner
See CONTRIBUTING.md <CONTRIBUTING.md>
_ for details.
See FAQ.md <FAQ.md>
_ for details.
svgcleaner is licensed under the GPL-2.0 <https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html>
_.