Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在Rmagic中,如何在带有标题的图像上添加行间间距_Ruby_Imagemagick_Rmagick - Fatal编程技术网

Ruby 在Rmagic中,如何在带有标题的图像上添加行间间距

Ruby 在Rmagic中,如何在带有标题的图像上添加行间间距,ruby,imagemagick,rmagick,Ruby,Imagemagick,Rmagick,使用Rmagic,我将执行以下操作以创建包含大量文本的图像 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::WestGravit

使用Rmagic,我将执行以下操作以创建包含大量文本的图像

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
这会产生以下错误:

 undefined method `interline_spacing=' for #<Magick::Image::Info:0x00000101aad190> (NoMethodError)
用于#的未定义方法“行间间距=”(NoMethodError)

如何在此处添加线条空间?

它是
绘图
对象的属性,而不是
图像
对象的属性。它适用于显式换行。至少对我来说是这样的:

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

你解决过这个问题吗?我也有同样的问题。