Scour - an SVG scrubber
Scour is an open-source Python script that aggressively cleans SVG files, removing a lot of 'cruft' that certain tools or authors embed into their documents. The goal of scour is to provide an identically rendered image (i.e. a scoured document should have no discernable visible differences from the original file).
WARNING: Scour is intended to be run on files that have been edited in Vector Graphics editors such as Inkscape or Adobe Illustrator. Scour attempts to optimize the file, and as result, it will change the file's structure and (possibly) its semantics. If you have hand-edited your SVG files, you will probably not be happy with the output of Scour. NEVER USE SCOUR TO OVERWRITE YOUR ORIGINAL FILE!
Command Line Script
$ python scour.py -i input.svg -o output.svg
In addition, you can use compressed svg (.svgz) on the input and output and scour will decompress/compress automatically.
If you want this in your Inkscape then download this zipfile, unzip it in your Inkscape's
extensions/ folder. Now when you Save As you will see an option for "Optimized SVG (*.svg)". This extension is included with Inkscape 0.47.
Scour performs many operations automatically. In addition to these automatic operations, scour also provides some configurable options:
In case you're curious, I am maintaining a sample set of real files that I've found and recording statistics on versions of scour. You can help me build this into a decent cross-section of real-world SVG documents by sending me files. Over time I hope this will give a decent sense of what scour can do. My current stats show a Median Reduction Factor of 48.19% and a Mean Reduction Factor of 48.53% over 25 sample files for version 0.19 of scour, before gzip compression.
See the Release Notes for what has changed.