I have this code:
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
is an ImageList with 96 images in it, populated as follows
images = ImageList.new()
urls.each do |url|
images << Image.read(url)[0]
end
Where urls
is just an array of image URLs
For some reason, after calling collage.flatten_image
and saving that resulting image, I only have 24 photos in the grid with whitespace filling the rest. Has anyone seen this behavior before?
EDIT: It appears that this only happends with 96 images.... Any other number works fine
Figured it out.
Looks like in some cases, montage returns an array of images. You need to deal with it somehow.
In my case, I used resample
to get the correct DPI and merge the images in one go.