Rails + Carrierwave + RMagick : Crop only if image is large
I am using carrier-wave to upload images. On upload I am creating
thumbnails for the image which is done using Rmagick method,
resize_to_fill like below.
version :thumb do
process :resize_to_fill=> [150, 150]
end
Here is output of all the RMagick methods carrierwave supports (none of
which i want):
1] :resize_to_fill => [150,150
This works fine on larger images but my smaller images are enlarged to 150
x 150.
2] :resize_to_fit => [150,150]
Again it was resized, I want it left alone!
3] :resize_to_limit => [150,150]
This one leaves it as is, but larger images are not cropped. They are
resized to keep the aspect ratio.
Here is the result I want and how my small and larger images should look.
How do this? I want smaller images to be left alone and crop only larger
images to 150 x 150. Is there another method or options I can pass to
resize_to_fill?
Thanks
No comments:
Post a Comment