Resizing images in rails?

Hi,

how to resize the images in rails app?
i want 400X300 size images to display in my app.But if user enter

600X800 how to resize the image without effect on clarity?

now i am using this code

 image =

Magick::Image.read("#{RAILS_ROOT}/public/gallery/#{review_img}").first
selected_image = image.crop_resized(400,400)
selected_image.write("#{RAILS_ROOT}/public/gallery/#{review_img}")

But it extract height and width.i dont want to extract only resize
the image.
any suggestion are appreciated.

thanks,
ravi.

==model (using attachment_fu)

class Picture < ActiveRecord::Base
belongs_to :user

has_attachment :content_type => :image,
:processor => ‘image_science’,
:storage => :file_system,
:path_prefix => File.join(‘public’, ‘images’,
‘pictures’, ‘’),
:resize_to => ‘400’,
:thumbnails => { :thumb => [150, 203]}

validates_as_attachment
end

will resize the image when created.

On Aug 27, 2:56 pm, Ravi K. [email protected]