【问题标题】:How to -draw text and -shadow it in ImageMagick?如何在 ImageMagick 中绘制文本和阴影?
【发布时间】:2013-12-31 13:45:22
【问题描述】:

我正在使用 convert 在图像上打印一些文本,我想用黑色阴影装饰文本,我尝试了 -blur-高斯 但我不能应用于文本,它只应用于背景图像。 我需要使用 -draw 命令而不是 -annotate

这是我需要更新的阴影代码

-font "geometricslab703bt-bold-webfont.ttf" -fill White -pointsize 18 -draw "rotate -4 text 350,250 '---- mijn ideale ----'"

提前致谢

【问题讨论】:

    标签: text imagemagick draw shadow imagemagick-convert


    【解决方案1】:

    处理文本阴影的更好、更灵活的方法是在新图层上渲染阴影。此方法将允许您根据需要操纵阴影文本,而不会影响背景。最后在调整任何几何偏移后在阴影顶部绘制实际文本。这是一个例子:

    convert -size 280x100 pattern:SMALLFISHSCALES \
      \( xc:transparent -font "Menlo" -pointsize 32 -fill black -draw "rotate -4 text 20,60 'ImageMagick'" -blur 0x1 \) \
      -geometry +2+2   -composite \
      -font "Menlo" -fill white -pointsize 32 -draw "rotate -4 text 20,60 'ImageMagick'" \
      example.png
    

    转义的大括号“\( \)”将创建一个新的子图像;其中,将使用-composite 标志应用于背景。

    此解决方案的劳动强度更大,但可以隔离所有效果。

    【讨论】:

      【解决方案2】:

      你可以用caption画文字,用clone做一个阴影层,然后合并两个层。

      convert logo: -resize 40%x40 \
          \( -size "80x40" -background none -gravity west  -fill green caption:"Caption text" \
          \( +clone -background navy -shadow 80x3+5+5  \) +swap -background none -layers merge +repage \) -composite \
          \( -size "80x40" -background none -gravity east  -fill green caption:"Caption text"  \
          \( +clone -background red -shadow 80x3+5+5  \) +swap -background none -layers merge +repage \) -composite \
          out.png
      
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-16
        • 2010-10-22
        • 2012-02-03
        • 1970-01-01
        • 2022-07-14
        • 2012-02-16
        • 1970-01-01
        相关资源
        最近更新 更多