Report abuse

 # scaling 
      w, h = imagesize(path)
      ow, oh = opts[:width], opts[:height]
      if ow && !oh
        opts[:height] = (ow.is_a? Float) ? ow : (ow * h/w.to_f).to_i
      elsif oh && !ow
        opts[:width]  = (oh.is_a? Float) ? oh : (oh * w/h.to_f).to_i
      end