我试图用标题和/或标签在我的图片上写多行文字,但它不会在图片上写任何东西。你知道吗
def self.post_open_ended_response
image = MiniMagick::Image.open("public/text_response_bg.png")
image.combine_options do |i|
i.size "460x"
i.gravity 'center'
i.fill 'white'
i.pointsize '40'
i.caption 'blahblahblah'
# i.label "blahblah fsdfsd fsd fsd fds fsd fds fds"
# i.composite "public/output.jpg"
end
image.write "public/output.jpg"
end
我之所以要使用标题/标签而不是文本,是因为我读到imagemagick会神奇地缩放标题/标签的点大小。我的文本长度会有所不同,所以我不想硬编码。你知道吗
对于任何其他人谁可能面临的问题在未来-更新到最新的创业板(目前4.2.0)。我是4.0.4版的,有个问题:
https://github.com/minimagick/minimagick/issues/191
更新-一般只需使用注解-它的工作。如果您需要文本操作,可以使用TextHelpers来完成。作为多行注释的示例,我完成了以下操作:
相关问题 更多 >
编程相关推荐