gpt4 book ai didi

macos - 使用 librsvg/rsvg 使用 ImageMagick 转换 SVG 图像

转载 作者:行者123 更新时间:2023-12-04 02:42:00 34 4
gpt4 key购买 nike

我知道这个问题在这里有几个答案版本(例如: ImageMagick convert SVG to PNG not working with RSVG enabled ),但实际上我找不到真正解决我的确切问题的方法。我的问题是:我有一个特定的 SVG 文件(我会生成更多),SVG>PNG 转换器进程中的 ImageMagick 无法完美转换。所以我需要把它改成 librsvg ,因为它确实如此,我用不同的结果测试了这两行:

    convert test.svg test.png  // ( img: http://tinyurl.com/px2lw3v )
rsvg-convert test.svg -o test.png // ( img: http://tinyurl.com/lreu6sk )

我安装了 HomeBrew。如此处所述: ImageMagick convert SVG to PNG not working with RSVG enabled我使用此代码安装 ImageMagick brew install imagemagick --use-rsvg .我意识到它没有安装 librsvg 所以我需要卸载它并像这样重新安装: brew reinstall imagemagick --with-libsrvg librsvg --use-rsvg :这将 imagemagick 和 librsvg 一起安装到我的 Mac 上。但是没有连接它们: convert -list format | grep SVG结果如下:

 MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
SVG SVG rw+ Scalable Vector Graphics (XML 2.9.0)
SVGZ SVG rw+ Compressed Scalable Vector Graphics (XML 2.9.0)


而这个: convert -list delegate | grep svg结果如下:
    svg =>          "rsvg-convert" -o "%o" "%i"

我安装&卸载&重新安装它们几次&方式但没有改变和脚本 convert test.svg test.png在没有 librsvg 的情况下这样做。我在/usr/local/Cellar/imagemagick/6.8.9-1/lib/ImageMagick/config-Q16/configure.xml 中添加了带有标签的行,但没有任何进展。我不知道该怎么做以及如何连接 ImageMagick 并强制为 convert test.svg test.png 使用不同的库.

谢谢你的帮助。

更多信息:
    $ which convert
/usr/local/bin/convert

$ convert -version
Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules
Delegates: bzlib freetype jng jpeg ltdl lzma png xml zlib

$ otool -L $(which convert)
/usr/local/bin/convert:
/usr/local/Cellar/imagemagick/6.8.9-1/lib/libMagickCore-6.Q16.2.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/local/Cellar/imagemagick/6.8.9-1/lib/libMagickWand-6.Q16.2.dylib (compatibility version 3.0.0, current version 3.0.0)
/usr/local/lib/libfreetype.6.dylib (compatibility version 18.0.0, current version 18.2.0)
/usr/lib/liblzma.5.dylib (compatibility version 6.0.0, current version 6.3.0)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/local/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

$ which rsvg-convert
/usr/local/bin/rsvg-convert

$ otool -L $(which rsvg-convert)
/usr/local/bin/rsvg-convert:
/usr/local/Cellar/librsvg/2.36.3/lib/librsvg-2.2.dylib (compatibility version 39.0.0, current version 39.3.0)
/usr/local/lib/libgdk_pixbuf-2.0.0.dylib (compatibility version 3001.0.0, current version 3001.8.0)
/usr/local/lib/libgio-2.0.0.dylib (compatibility version 4001.0.0, current version 4001.0.0)
/usr/local/lib/libpangocairo-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.5.0)
/usr/local/lib/libpango-1.0.0.dylib (compatibility version 3601.0.0, current version 3601.5.0)
/usr/local/lib/libgobject-2.0.0.dylib (compatibility version 4001.0.0, current version 4001.0.0)
/usr/local/lib/libcairo.2.dylib (compatibility version 11203.0.0, current version 11203.16.0)
/usr/local/lib/libpng16.16.dylib (compatibility version 29.0.0, current version 29.0.0)
/usr/local/lib/libcroco-0.6.3.dylib (compatibility version 4.0.0, current version 4.1.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
/usr/local/lib/libgthread-2.0.0.dylib (compatibility version 4001.0.0, current version 4001.0.0)
/usr/local/lib/libglib-2.0.0.dylib (compatibility version 4001.0.0, current version 4001.0.0)
/usr/local/opt/gettext/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
  • ImageMagick 6.6.9-1
  • Mac OS X 10.9.4
  • 最佳答案

    (只是在 Zoltan 的答案中添加更多上下文)

    使用 brew info imagemagick安装时查看可用选项。

    --with-librsvg
    Build with librsvg support

    关于macos - 使用 librsvg/rsvg 使用 ImageMagick 转换 SVG 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24513244/

    34 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com