← 返回命令列表

Linux command

svgcleaner 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Clean SVG

svgcleaner [input.svg] [output.svg]

Maximum compression

svgcleaner --preset=maximum [input.svg] [output.svg]

Preserve specific attributes

svgcleaner --keep-named-ids [input.svg] [output.svg]

Indent output

svgcleaner --indent [2] [input.svg] [output.svg]

Quiet mode

svgcleaner -q [input.svg] [output.svg]

说明

svgcleaner performs lossless optimization of SVG files, reducing file size without altering their visual appearance. It removes unnecessary metadata, editor artifacts, unused definitions, and redundant attributes that bloat SVG files exported from graphic editors. The tool simplifies path data, optimizes geometry, merges compatible elements, and removes empty groups and containers. Multiple optimization passes can be applied for maximum size reduction. Optimization presets allow choosing between conservative and aggressive cleaning levels. Written in Rust for performance, svgcleaner is particularly effective at cleaning SVGs produced by editors like Inkscape, Adobe Illustrator, and Sketch, which often embed substantial editor-specific metadata and redundant styling information.

参数

--preset _NAME_
Optimization preset.
--keep-named-ids
Preserve IDs.
--indent _N_
Indentation spaces.
-q
Quiet mode.
--multipass
Multiple optimization passes.

FAQ

What is the svgcleaner command used for?

svgcleaner performs lossless optimization of SVG files, reducing file size without altering their visual appearance. It removes unnecessary metadata, editor artifacts, unused definitions, and redundant attributes that bloat SVG files exported from graphic editors. The tool simplifies path data, optimizes geometry, merges compatible elements, and removes empty groups and containers. Multiple optimization passes can be applied for maximum size reduction. Optimization presets allow choosing between conservative and aggressive cleaning levels. Written in Rust for performance, svgcleaner is particularly effective at cleaning SVGs produced by editors like Inkscape, Adobe Illustrator, and Sketch, which often embed substantial editor-specific metadata and redundant styling information.

How do I run a basic svgcleaner example?

Run `svgcleaner [input.svg] [output.svg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --preset _NAME_ do in svgcleaner?

Optimization preset.