Resizing to fill a space
Posted: 2014-09-03T23:08:00-07:00
I have thumbnail product images that are in different aspect ratios and sizes. This is a marketplace app so sellers will load images in various sizes. I want to resize to make them fit within the 200x200 thumbnail grid that I have. i.e. if the aspect ratio is not square, fill the blank space so the image is 200x200.
I'm on Rails 4, Paperclip 4.1, Imagemagick 6.8.9
Based on an earlier version of IM, this is the effect I want - http://www.imagemagick.org/Usage/resize/#space_fill - See the problem with alignment on my demo site here - http://mktdemo.herokuapp.com
Can someone help with what convert options I should use below. Here is my rails model code. I tried playing with some options but didn't get it to align as I wanted. The swap+ option as outlined in the link above doesn't work in newer versions.
I'm on Rails 4, Paperclip 4.1, Imagemagick 6.8.9
Based on an earlier version of IM, this is the effect I want - http://www.imagemagick.org/Usage/resize/#space_fill - See the problem with alignment on my demo site here - http://mktdemo.herokuapp.com
Can someone help with what convert options I should use below. Here is my rails model code. I tried playing with some options but didn't get it to align as I wanted. The swap+ option as outlined in the link above doesn't work in newer versions.
Code: Select all
has_attached_file :image,
:styles => { :medium => "200x200", :thumb => "100x100" },
:default_url => ""
:convert_options => {:medium => ???}