Using Rmagic I am doing the following to create an image with a large amount of text
message="A very long auto wrapping sentence goes here"
text_image = Image.read("caption:#{message}") do
self.size="500x500"
self.fill="white"
self.background_color="#67c6ae"
self.gravity=GravityType::WestGravity
self.interline_spacing=5
end
This gives the error:
undefined method `interline_spacing=' for #<Magick::Image::Info:0x00000101aad190> (NoMethodError)
How can I add line space here?
It is a property of the Draw
object, not the Image
object. And it works with explicit line breaks. At least thats how its working for me:
image = Image.new(499,649)
message = "this\nmessage\nis\nmultiline"
draw = Draw.new
draw.annotate(image, 0,0,0,0,message) do
self.gravity = NorthWestGravity
self.pointsize = 32
self.font_family = "Arial"
self.font_weight = NormalWeight
self.stroke = "none"
self.fill = font_color
self.interline_spacing = -5
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With