Module: Imogen::Scaled

Defined in:
lib/imogen.rb

Class Method Summary collapse

Class Method Details

.convert(img, dest_path, scale = 1500, format = :jpeg) ⇒ Object



9
10
11
12
13
14
# File 'lib/imogen.rb', line 9

def self.convert(img, dest_path, scale=1500, format = :jpeg)
  w = img.width
  h = img.height
  dims = (w > h) ? [scale, scale*h/w] : [scale*w/h, scale]
  img.thumbnail_image(dims[0], height: dims[1]).write_to_file(dest_path)
end