ImageMagick multiline text and background image

亡梦爱人 提交于 2019-12-07 08:00:39

问题


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: I'm using RubyOnRails with ImageMagick, but you can suggest examples with MiniMagick or Rmagick. Thanks.


回答1:


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


来源:https://stackoverflow.com/questions/10353401/imagemagick-multiline-text-and-background-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!