class Teaas::Resize
Public Class Methods
resize(img, resize, options={})
click to toggle source
# File lib/teaas/resize.rb, line 3 def self.resize(img, resize, options={}) img = img.coalesce resize = "#{img.columns}x#{img.rows}" if resize.nil? || resize.empty? img.each do |frame| frame.change_geometry(resize) do |cols, rows, i| if options[:sample] i.sample!(cols, rows) else i.resize!(cols, rows) end end end img end
resize_from_file(path, resize, options={})
click to toggle source
# File lib/teaas/resize.rb, line 19 def self.resize_from_file(path, resize, options={}) img = Magick::ImageList.new img.read(path) resize(img, resize, options) end