【问题标题】:Shadow text with ImageMagick使用 ImageMagick 的阴影文本
【发布时间】:2019-08-01 21:04:26
【问题描述】:

我整天都在使用命令行 imagemagick 为文本添加阴影。谷歌搜索了很多页面并尝试使用高斯、模糊、阴影命令来投射阴影,但没有成功。

这是我在 php 中的命令:

$img_save = 'C:\Users\abc\Desktop\testimage.jpg';

$line = "Anatidaephobia is the fear that somewhere in the world there is a duck watching you. ";
$line = wordwrap($line, 25, "\\n");   

exec("convert -background white -weight bold -size 500x -pointsize 35 -font arial-italic -gravity center -fill black caption:\"$line\" $img_save");

上面的代码没有困难地给出图像。谁能告诉如何给图片中的文字添加阴影?

谢谢

【问题讨论】:

    标签: php imagemagick


    【解决方案1】:

    使用 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 out.png
    

    【讨论】:

      【解决方案2】:

      你只需要先画阴影,然后用字体在上面画

      convert -size 500x500 xc:white -pointsize 35 -font arial-italic -gravity center       - fill red -draw "text 2,2 'text'" -fill black -draw "text 0,0 'text'" outfile.jpg
      

      【讨论】:

      • 我不能用这个自动换行。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-12-08
      • 2012-12-08
      • 1970-01-01
      • 2015-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多