【问题标题】:imagemagick: append label, gravity buggyimagemagick:附加标签,重力车
【发布时间】:2018-11-08 16:47:20
【问题描述】:

我试图在

中重现提示

imagemagick: append a label under image with font size

这是我的源图片:

convert red.png -pointsize 36 label:"Test label" -gravity center -append red2.png

但不是预期的结果(标签放在底部居中)我得到了这个

我不认为 imagemagick 有错误。那么,我做错了什么?

这里是版本信息

convert -version

GraphicsMagick 1.4 快照-20181020 Q16 http://www.GraphicsMagick.org/ 版权所有 (C) 2002-2018 GraphicsMagick 团体。附加版权和许可适用于该软件。看 http://www.GraphicsMagick.org/www/Copyright.html了解详情。

功能支持:本机线程安全是大文件(> 32 位) 是 大内存 (> 32 位) 是 BZIP
是 DPS 否 FlashPix 否
FreeType 是 Ghostscript(库) 否 JBIG
是 JPEG-2000 否 JPEG 是
Little CMS 是 可加载模块 否 OpenMP
是 (201511) PNG 是 TIFF
是 TRIO 没有 UMEM 没有 WebP 是 WMF 是 X11 是
XML 是 ZLIB 是

主机类型:x86_64-pc-linux-gnu

使用命令配置:./configure '--build' 'x86_64-linux-gnu' '--enable-shared' '--enable-static' '--enable-libtool-verbose' '--prefix=/usr' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--docdir=${prefix}/share/doc/graphicsmagick' '--with-gs-font-dir=/usr/share/fonts/type1/gsfonts' '--with-x' '--x-includes=/usr/include/X11' '--x-libraries=/usr/lib/X11' '--without-dps' '--without-modules' '--without-frozenpaths' '--with-webp' '--with-perl' '--with-perl-options=INSTALLDIRS=vendor' '--enable-quantum-library-names' '--with-quantum-depth=16' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/graphicsmagick-1.3.30+hg15796=。 -fstack-protector-strong -Wformat -Werror=format-security''LDFLAGS=-Wl,-z,relro -Wl,-z,now''CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fdebug-prefix-map=/build/graphicsmagick-1.3.30+hg15796=. -fstack-protector-strong -Wformat -Werror=format-security'

最终构建参数:CC = gcc CFLAGS = -fopenmp -g -O2 -fdebug-prefix-map=/build/graphicsmagick-1.3.30+hg15796=。 -fstack-protector-strong -Wformat -Werror=format-security -Wall -pthread CPPFLAGS = -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/X11 -I/usr/include/freetype2 -I/usr/include /libxml2 CXX = g++ CXXFLAGS = -g -O2 -fdebug-prefix-map=/build/graphicsmagick-1.3.30+hg15796=。 -fstack-protector-strong -Wformat -Werror=format-security -pthread LDFLAGS = -Wl,-z,relro -Wl,-z,now -L/usr/lib/X11 -L/usr/lib/x86_64-linux-gnu LIBS = -ljbig -lwebp -lwebpmux -llcms2 -ltiff -lfreetype -ljpeg -lpng16 -lwmflite -lXext -lSM -lICE -lX11 -llzma -lbz2 -lxml2 -lz -lm -lgomp -lpthread

【问题讨论】:

  • 从版本信息来看,您使用的是 GraphicsMagick,所以我不明白您为什么称它为 ImageMagick 并在不是时将其标记为这样。 ImageMagick 和 GraphicsMagick 是两个不同的东西。
  • 这很重要。我没有意识到这一点。谢谢。

标签: imagemagick


【解决方案1】:

感谢 Mark,我能够发现错误。

看起来我并行安装了 GraphicsMagick 和 ImageMagick,但不知何故,它们会相互干扰。我真的不知道。

所以我卸载了带有所有依赖项(我从未使用过)的 GraphicsMagick 并重新安装了 ImageMagick。

现在它可以正常工作了。

【讨论】:

    【解决方案2】:

    在 ImageMagick 中,label: 创建一个新图像。因此,您需要将其附加到红色图像下方。为此,您应该使用括号处理来创建标签:图像。这样读起来更干净。

    convert red.png \( -background white -fill black -pointsize 36 label:"Test label" \) -gravity center -append red2.png
    


    https://imagemagick.org/Usage/text/#label

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-13
      • 2019-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多