Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.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 ImageList#蒙太奇不包括大多数照片_Ruby_Rmagick - Fatal编程技术网

Ruby ImageList#蒙太奇不包括大多数照片

Ruby ImageList#蒙太奇不包括大多数照片,ruby,rmagick,Ruby,Rmagick,我有以下代码: marginsBetween = 20 background = '#000000' columns = 6 rows = 12 collage = images.montage { self.geometry = '+' + (marginsBetween/2).to_s + '+' + (marginsBetween/2).to_s self.tile = columns.to_s + 'x' + rows.to_s self.background_color

我有以下代码:

marginsBetween = 20
background = '#000000'

columns = 6
rows = 12

collage = images.montage {
  self.geometry = '+' + (marginsBetween/2).to_s + '+' + (marginsBetween/2).to_s
  self.tile = columns.to_s + 'x' + rows.to_s
  self.background_color = background
}
images
是一个包含96个图像的图像列表,按如下方式填充

images = ImageList.new()
urls.each do |url|
  images << Image.read(url)[0]
end
images=ImageList.new()
url.each do | url|
图像找到了答案

在某些情况下,蒙太奇会返回一组图像。你需要设法处理它

在我的例子中,我使用了
重采样
来获得正确的DPI并一次性合并图像。

解决了这个问题

在某些情况下,蒙太奇会返回一组图像。你需要设法处理它

在我的例子中,我使用了
resample
来获得正确的DPI并一次性合并图像