# File lib/asset_compiler/rmagick_transformation_script.rb, line 127 def crop_to size_string, gravity = :center width, height = size_string.scan( /\d+/ ).collect { |i| i.to_i } max = ( width > height ? width : height ) aspect = @image.columns.to_f / @image.rows.to_f @image.resize!( max, ( max / aspect ).to_i ) if aspect < 1.0 @image.resize!( (max*aspect).to_i, max ) unless aspect < 1.0 # radius, sigma, blend, threshold unsharp_mask 0.5, 1.0, 0.5, 0.25 @image.crop!( GRAVITY_TYPES[gravity], width, height ) @image end