Class: WallScaler

Inherits:
Object
  • Object
show all
Includes:
WallOperations
Defined in:
lib/wall_scaler.rb

Instance Method Summary collapse

Methods included from WallOperations

#get_scaled_size, #place_onto, #place_through, #prepare_backdrop, #prepare_image, #save_image

Instance Method Details

#scale(image, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wall_scaler.rb', line 9

def scale(image, options = {})
  width  = options['width']  || 1920
  height = options['height'] || 1200
  color  = options['color']  || 'black'
  title  = options['title']  || "#{File.basename(image, ".jpg")} scaled.jpg"

  im = prepare_image(image, width, height)

  result = prepare_backdrop({'width'  => width,
                             'height' => height,
                             'color'  => color})

  place_through(0, 0, width, height, im, result)
  save_image(result, title)
end