ImageMagick多行文本和背景图像 [英] ImageMagick multiline text and background image

查看:126
本文介绍了ImageMagick多行文本和背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习使用ImageMagick,但是当我尝试生成如下例子的图片时遇到了麻烦:

I'm learning to use ImageMagick, but I'm having trouble when I try to generate an image like the example below:

为此,我使用以下代码:

And for that, I'm using the following code:

convert original.jpg -size 460x caption:'This is a multiline caption, This is a multiline caption, This is a multiline caption.' result.jpg

此命令生成两个单独的图像,一个只有标题。你能帮助我吗?

This command generated two separate images, one with just the title. Can you help me?

PS:我正在使用带有ImageMagick的RubyOnRails,但是你可以使用MiniMagick或Rmagick建议示例。谢谢。

PS: I'm using RubyOnRails with ImageMagick, but you can suggest examples with MiniMagick or Rmagick. Thanks.

推荐答案

这适用于php,我无法理解为什么它不起作用RubyOnRails:

This works in php and I can not see why it will not work o RubyOnRails:

convert original.jpg -size 460x -background transparent -fill black -pointsize 40 caption:'This is a multiline caption, This is a multiline caption, This is a multiline caption.'  -gravity center -composite result.jpg

这篇关于ImageMagick多行文本和背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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