From: Michael Morin Date: 2008-08-29T00:51:13+09:00 Subject: Re: resizing images in rails? Ravi Katta wrote: > > 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. First, resizing 400x300 to 600x800 changes the aspect ratio. The image will appear "squashed." Second, scaling up will always involve some pixelization, blurriness or other unwanted things. Third, you can have the web browser do this for you. See the width and height attributes to the img tag. -- Michael Morin Guide to Ruby http://ruby.about.com/ Become an About.com Guide: beaguide.about.com About.com is part of the New York Times Company