I am trying to make a fixed square image crop with Ruby on Rails, CarrierWave, and RMagick.
I have tried both of the following with no luck...
version :thumb do
process :resize_to_fit => [200, 200]
end
and
version :thumb do
process :resize_to_limit => [200, 200]
end
resize_to_limit obviously resizes the image to fit within the specified dimensions while retaining the original aspect ratio. So that's not right, but resize_to_fit doesn't do it either. I am looking at all of the available of the instance methods here.
I want to be able to upload a picture of any aspect ratio and dimensions and it will come out at 200x200.
Finally got this! After trying a bunch of different custom image manipulation functions and manual cropping it's actually as simple as I had hoped for...
process :resize_to_fill => [400, 400]
Crops it into a 400x400 square from the direct center of the original image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With