Sha256: 0f199d89d4e9dedfdcd50b5ea0ff3212e969a3b85b483631d86f7daa10c64727
Contents?: true
Size: 972 Bytes
Versions: 3
Compression:
Stored size: 972 Bytes
Contents
Dimension ========= Fast, simplified image resizing for Ruby. No ImageMagick. ``` rb require 'dimension' thumb = Dimension.open('tux.png') thumb.generate('100x100') # => { :width => 100, :height => 100 } thumb.save('resized.png') ``` Or generate and write file automatically. ``` rb thumb = Dimension.new('tux.png') thumb.generate!('100x300!') # will write file as 'tux-100x300.png' ``` # In memory processing Yes sir, we have it. ``` rb thumb = Dimension.open(params[:file]) thumb.generate('200x300#') thumb.image_data ``` You can also pass a block, which will ensure the original image is closed after processing. ``` rb get '/resize/:file' do thumb = Dimension.open(params[:file]) thumb.generate('200x300#') do thumb.to_response end end ``` # Resizing geometries This is taken directly from the excellent Dragonfly gem. Author ====== Written by Tomás Pollak. Copyright ========= (c) Fork, Ltd. MIT Licensed.
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dimension-0.1.1 | README.md |
dimension-0.0.7 | README.md |
dimension-0.0.6 | README.md |