scour - Optimize and clean SVG files
scour [INPUT.SVG [OUTPUT.SVG]]
[OPTIONS]
Scour is an SVG optimizer/cleaner that reduces the size of
scalable vector graphics by optimizing structure and removing unnecessary
data.
The goal of Scour is to output a file that renderes identically at
a fraction of the size by removing a lot of redundant information created by
most SVG editors.
Optimization options are typically lossless but can be tweaked for
more agressive cleaning.
If the input/output files are not specified, stdin/stdout are
used. If the input/output files are specified with a svgz extension, then
compressed SVG is assumed.
- --version
- show program's version number and exit
- -h, --help
- show this help message and exit
- -q, --quiet
- suppress non-error output
- -v, --verbose
- verbose output (statistics, etc.)
- -i INPUT.SVG
- alternative way to specify input filename
- -o OUTPUT.SVG
- alternative way to specify output filename
- Optimization:
- --set-precision=NUM
- set number of significant digits (default: 5)
- --set-c-precision=NUM
- set number of significant digits for control points (default: same as
'--set-precision')
- --disable-simplify-colors
- won't convert colors to #RRGGBB format
- --disable-style-to-xml
- won't convert styles into XML attributes
- --disable-group-collapsing
- won't collapse <g> elements
- --create-groups
- create <g> elements for runs of elements with identical
attributes
- --keep-editor-data
- won't remove Inkscape, Sodipodi, Adobe Illustrator or Sketch elements and
attributes
- --keep-unreferenced-defs
- won't remove elements within the defs container that are unreferenced
- --renderer-workaround
- work around various renderer bugs (currently only librsvg) (default)
- --no-renderer-workaround
- do not work around various renderer bugs (currently only librsvg)
- SVG document:
- --strip-xml-prolog
- won't output the XML prolog (<?xml ?>)
- --remove-titles
- remove <title> elements
- --remove-descriptions
- remove <desc> elements
- --remove-metadata
- remove <metadata> elements (which may contain license/author
information etc.)
- --remove-descriptive-elements
- remove <title>, <desc> and <metadata> elements
- --enable-comment-stripping
- remove all comments (<!-- -->)
- --disable-embed-rasters
- won't embed rasters as base64-encoded data
- --enable-viewboxing
- changes document width/height to 100%/100% and creates viewbox
coordinates
- Output formatting:
- --indent=TYPE
- indentation of the output: none, space, tab (default: space)
- --nindent=NUM
- depth of the indentation, i.e. number of spaces/tabs: (default: 1)
- --no-line-breaks
- do not create line breaks in output(also disables indentation; might be
overridden by xml:space="preserve")
- --strip-xml-space
- strip the xml:space="preserve" attribute from the root SVG
element
- ID attributes:
- --enable-id-stripping
- remove all unreferenced IDs
- --shorten-ids
- shorten all IDs to the least number of letters possible
- --shorten-ids-prefix=PREFIX
- add custom prefix to shortened IDs
- --protect-ids-noninkscape
- don't remove IDs not ending with a digit
- --protect-ids-list=LIST
- don't remove IDs given in this commaseparated list
- --protect-ids-prefix=PREFIX
- don't remove IDs starting with the given prefix
- SVG compatibility checks:
- --error-on-flowtext
- exit with error if the input SVG uses nonstandard flowing text (only warn
by default)
Standard:
- scour -i input.svg -o output.svg
For better compatibility with web browsers:
- scour -i input.svg -o output.svg --enable-viewboxing
Maximum scrubbing:
- scour -i input.svg -o output.svg --enable-viewboxing
--enable-id-stripping \
--enable-comment-stripping --shorten-ids --indent=none
Maximum scrubbing and a compressed SVGZ file:
- scour -i input.svg -o output.svgz --enable-viewboxing
--enable-id-stripping \
--enable-comment-stripping --shorten-ids --indent=none
Jeff Schiller, Louis Simard, 2010
Enkelena Haxhija (EnkelenaH) has produced this man page from the
upstream README and the --help output for Debian with the help of
pandoc(1) and help2man(1). The latter is executed at build
time so --help output and this man page should stay consistent.