class Udongo::ImageManipulation::ResizeToFit
Public Instance Methods
resize(path)
click to toggle source
Resize the image to fit within the specified dimensions while retaining the original aspect ratio. The image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values.
# File lib/udongo/image_manipulation/resize_to_fit.rb, line 12 def resize(path) img = MiniMagick::Image.open(@file) img.combine_options do |c| c.quality @options[:quality] if @options[:quality] c.resize "#{@width}x#{@height}" end img.write(path) end