如何在ImageMagick中绘制文本并对其进行阴影? [英] How to -draw text and -shadow it in ImageMagick?

查看:286
本文介绍了如何在ImageMagick中绘制文本并对其进行阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm printing some text on an image with convert and I would like to decorate the text with a black shadow, I tried -blur or -gaussian but I cannot apply to the text, it is applied to the background image only. I need to use -draw command and not -annotate.

这是代码我需要更新阴影

And this is the code I need to update for shadowing

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

请提前谢谢

推荐答案

一种更好,更灵活的使用文本阴影的方法是在新图层上渲染阴影。使用此方法,您可以根据需要操纵阴影文本,而不会影响背景。调整任何几何偏移后,最后在阴影顶部绘制实际文本。例如:

A better, more flexible, way to work with text shadow is to render the shadow on a new layer. This method will allow you to manipulate the shadow-text, as needed, without affecting the background. Finally draw the actual text on top of the shadow after adjusting any geometric offsetting. Here's an example:

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 标志应用于背景。

The escaped braces "\( \)" will create a new sub-image; which, will be applied to the background with -composite flag.

此解决方案的劳动强度更高,但可以保留您所有的资源效果隔离。

This solution is a little bit more labor intensive, but keeps all your effects isolated.

这篇关于如何在ImageMagick中绘制文本并对其进行阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆