The script first crops the images to 160x160, then creates a vertical strip using RMagick's montage functionality.
require 'rubygems'
require 'RMagick'
files = Dir['*.jpg']
imageList = Magick::ImageList.new
numImages = 0
files.each do |file|
unless file == 'filmStrip.jpg'
puts "adding #{file}"
img = Magick::Image.read(file)[0]
img.crop_resized!(160,160)
imageList << img
numImages = numImages + 1
end
end
filmStrip = imageList.montage do
self.geometry = "160x160+0+0"
self.tile = "1x#{numImages}"
end
filmStrip.write('filmStrip.jpg')
0 comments: