如何使用 Ubuntu 上的软件减小 SVG 的大小?

Jos*_*nto 5 svg optimization

我想在 Ubuntu 上使用软件优化 SVG(优化我的意思是在不丢失图形的任何可见部分的情况下减小文件大小),我的意思是软件我知道有一些网站可以做到这一点,但我不不相信我的互联网连接总是足够好,这对我有用。我还想保留 SVG 文件格式,我知道 SVGZ 通常比未压缩的对应文件小得多,但我将这些 SVG 上传到本地 MediaWiki 安装,并且它无法根据我的知识缩略图 SVGZ 文件(如果我错了,请请纠正我)。

May*_*hux 5

我想不出比inkscape更好的东西了。

Inkscape 是一个开源矢量图形编辑器,类似于 Adob​​e Illustrator、Corel Draw、Freehand 或 Xara X。使 Inkscape 与众不同的是它使用可缩放矢量图形 (SVG),这是一种基于 XML 的开放 W3C 标准,作为原生格式.

您可以使用命令安装它:

sudo apt-get install inkscape
Run Code Online (Sandbox Code Playgroud)

查看链接以获取使用inkscape 优化SVG 的提示。


对于命令行,我认为你应该看看scour

scour --help
scour 0.26
Copyright Jeff Schiller, Louis Simard, 2010
Usage: scour [-i input.svg] [-o output.svg] [OPTIONS]

If the input/output files are specified with a svgz extension, then compressed
SVG is assumed. If the input file is not specified, stdin is used. If the
output file is not specified,  stdout is used.

Options:
  --version                   show program's version number and exit
  -h, --help                  show this help message and exit
  --disable-simplify-colors   won't convert all 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
  --enable-id-stripping       remove all un-referenced ID attributes
  --enable-comment-stripping  remove all <!-- --> comments
  --shorten-ids               shorten all ID attributes to the least number of
                              letters possible
  --disable-embed-rasters     won't embed rasters as base64-encoded data
  --keep-editor-data          won't remove Inkscape, Sodipodi or Adobe
                              Illustrator elements and attributes
  --remove-metadata           remove <metadata> elements (which may contain
                              license metadata etc.)
  --renderer-workaround       work around various renderer bugs (currently
                              only librsvg) (default)
  --no-renderer-workaround    do not work around various renderer bugs
                              (currently only librsvg)
  --strip-xml-prolog          won't output the <?xml ?> prolog
  --enable-viewboxing         changes document width/height to 100%/100% and
                              creates viewbox coordinates
  -p DIGITS, --set-precision=DIGITS
                              set number of significant digits (default: 5)
  -q, --quiet                 suppress non-error output
  --indent=INDENT_TYPE        indentation of the output: none, space, tab
                              (default: space)
  --protect-ids-noninkscape   Don't change IDs not ending with a digit
  --protect-ids-list=PROTECT_IDS_LIST
                              Don't change IDs given in a comma-separated list
  --protect-ids-prefix=PROTECT_IDS_PREFIX
                              Don't change IDs starting with the given prefix
Run Code Online (Sandbox Code Playgroud)

也看看这个SE 问题,它可能会有所帮助。