Class: Teaas::Resize
- Inherits:
-
Object
- Object
- Teaas::Resize
- Defined in:
- lib/teaas/resize.rb
Class Method Summary collapse
Class Method Details
.resize(img, resize, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/teaas/resize.rb', line 3 def self.resize(img, resize, ={}) 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 [:sample] i.sample!(cols, rows) else i.resize!(cols, rows) end end end img end |
.resize_from_file(path, resize, options = {}) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/teaas/resize.rb', line 19 def self.resize_from_file(path, resize, ={}) img = Magick::ImageList.new img.read(path) resize(img, resize, ) end |