Scour - an SVG scrubber
Table of Contents
Introduction
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!
Documentation
Installation and Using
Web-Based Version
If you want to simply try out scour, you can use the online version hosted at PlanetSVG.
Command Line Script
To run scour on the command-line, first download and install Python, then download scour. The basics are:
$ 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.
Inkscape Extension
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.
Configurable Options
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.
Development
Scour is open source under the Apache 2 License. It is maintained on Launchpad. Visit Launchpad to ask a question, report a bug, make a feature request or submit patches.
Downloads
See the Release Notes for what has changed.
Command-Line Script
- scour-0.26 - 2011-05-09
- scour-0.25 - 2010-07-11
- scour-0.24 - 2010-02-05