You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ImageMagick生成SVG时彩色文本变黑白,PNG输出正常求助

问题:ImageMagick输出SVG无色彩但PNG正常

执行以下命令:

convert \
    -density 300 \
    -gravity west \
    pango:'<span font="ubuntu 20" foreground="red" background="white">text1\n</span><span font="ubuntu 12" foreground="red" background="#3fa">text2</span>' \
    -gravity center \
    -extent 700x800 \
    caption.svg

生成的图像为黑白效果(文本为黑色,所有背景为白色),无任何色彩。但将输出文件改为caption.png时,命令可正常生成彩色图像。

补充:相关图像代码已确认Pango的色彩配置参数无误。

ImageMagick版本信息:

$ convert --version
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib

内容的提问来源于stack exchange,提问作者nightcod3r

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 12:02:51