2017-11-11 123 views
0

如何旋转文本然后在graphicsmagick中绘制? 这是一个简单的问题,但我从一个小时以来就无法从API了解它。如何旋转文本然后在graphicsmagick中绘制?

帮助将appriciated,谢谢。 我正在使用gm,但从命令行执行它也足够了。

此外还有一个关于这个问题的公开问题。 https://github.com/aheckmann/gm/issues/660

如果我们不能用graphicsmagick做到这一点,OpenCV或Imagemagick的替代方案是可能的。

+0

你能更具体吗?旋转文本并绘制​​*什么**? **哪里**?也许举个例子吧。 –

回答

1

我同意Mark Setchell。这个问题不明确。在ImageMagick中,您可以通过多种方式绘制旋转文字。 -annotate函数将通过它的参数来做到这一点。您还可以使用标签创建一个新的文本图像:然后旋转并在背景图像上进行组合。见http://www.imagemagick.org/Usage/text/http://www.imagemagick.org/script/command-line-options.php#annotate

输入:

enter image description here

convert logo.jpg -font Arial -pointsize 64 -fill red -gravity center -annotate 20x20+0+0 "TESTING" logo_test.jpg 

或交替使用-draw

convert logo.jpg -font Arial -pointsize 64 -fill red -gravity center -draw "rotate 20 text 0,0 'TESTING'" logo_test2.jpg 

enter image description here

对不起,我不知道GraphicsMagick工具,但它应该有一个类似的操作符来注释,也许是同一个名字。

+0

在GraphicsMagick的node.js中我找到了这个函数'.draw([“rotate -14 text 0,0”+ yourText])''''''''''''''''''''''''这个答案指出我找到了这个功能,这个功能在之前没有看到过。谢谢。 –

+0

如果您将使用变量,那么您的文本当然应该包含转义或单引号。恩。 'var yourText =“\”示例文本\“”' –