scour
TLDR
Optimize an SVG file
SYNOPSIS
scour [options] [-i input.svg] [-o output.svg]
DESCRIPTION
Scour is a Python-based SVG optimizer that reduces file size by removing unnecessary data and optimizing structure. It cleans "cruft" added by SVG editors while maintaining identical visual rendering.
Optimizations include removing unused elements and attributes, shortening numeric values, collapsing groups, and converting shapes to paths. The tool is designed for preparing SVGs for web deployment or further processing.
Scour performs lossless optimization by default, preserving the visual appearance of the original file. More aggressive options may alter structure but should not affect rendering.
PARAMETERS
-i file, --input=file
Input SVG file (default: stdin)-o file, --output=file
Output SVG file (default: stdout)-p digits, --set-precision=digits
Number of significant digits for coordinates--enable-id-stripping
Remove unreferenced ID attributes--enable-comment-stripping
Remove all comments--shorten-ids
Replace IDs with shorter versions--remove-metadata
Remove metadata elements--indent=type
Indentation type: none, space, tab-v, --verbose
Show statistics about optimization-q, --quiet
Suppress non-error output
CAVEATS
Never overwrite original files; Scour changes document structure and semantics. Hand-edited SVGs may not produce optimal results since Scour is designed for editor-generated files. Some optimizations may cause issues with specific SVG viewers or processors.
HISTORY
Scour was originally created by Jeff Schiller and Louis Simard as an open-source tool for SVG optimization. It became popular in the Inkscape community and is now maintained by Tobias Oberstein and Patrick Storz. Licensed under Apache-2.0.


