class Presto::Dimensions
Public Class Methods
resize(from_w, from_h, to_w=nil, to_h=nil)
click to toggle source
# File lib/presto/dimensions.rb, line 3 def self.resize from_w, from_h, to_w=nil, to_h=nil if to_w && to_h w = to_w h = to_h elsif to_w w = to_w scale_x = to_w / from_w.to_f h = (scale_x * from_h).round elsif to_h h = to_h scale_y = to_h / from_h.to_f w = (scale_y * from_w).round else w = from_w h = from_h end new(w, h) end