Sha256: 1a66d5a73f144eef1821a43f553b852e4b81a8291240c7a712654a3b3a285ece
Contents?: true
Size: 758 Bytes
Versions: 53
Compression:
Stored size: 758 Bytes
Contents
require_relative 'base' module Udongo module ImageManipulation class ResizeToLimit include Udongo::ImageManipulation::Base # Resize the image to fit within the specified dimensions while retaining # the original aspect ratio. Will only resize the image if it is larger than the # specified dimensions. The resulting image may be shorter or narrower than specified # in the smaller dimension but will not be larger than the specified values. # 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 end end end
Version data entries
53 entries across 53 versions & 1 rubygems