Class: WallMerger
Instance Method Summary collapse
Methods included from WallOperations
#get_scaled_size, #place_onto, #place_through, #prepare_backdrop, #prepare_image, #save_image
Instance Method Details
#merge(image_one, image_two, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wall_merger.rb', line 9 def merge(image_one, image_two, = {}) width_one = ['width_one'] || 1920 width_two = ['width_two'] || 1920 height_one = ['height_one'] || 1200 height_two = ['height_two'] || 1200 color = ['color'] || 'black' title = ['title'] || "#{File.basename(image_one, ".jpg")} and #{File.basename(image_two, ".jpg")}.jpg" # prepare image will retrieve the image and scale it im_one = prepare_image(image_one, width_one, height_one) im_two = prepare_image(image_two, width_two, height_two) result = prepare_backdrop({'width_one' => width_one, 'width_two' => width_two, 'height_one' => height_one, 'height_two' => height_two, 'color' => color}) # place through will drop the image onto the target with shifting place_through(0, 0, width_one, height_one, im_one, result) place_through(width_one, 0, width_two, height_two, im_two, result) save_image(result, title) end |