I have a photo attachment which I’m saving using Paperclip. However, I’d like to process the photo first before saving by cropping it down and then resizing to the final size:
e.g. I have a 900×900 photo, I want to first do a central crop to 500×500, and then resize the cropped photo down to a thumbnail size of 100×100.
The purpose of this is so that the thumbnail image wouldn’t simply be a scaled down version of the 900×900 since it might be too small to even make out anything in the photo. By cropping it, we reduce a huge part of photo that can be left out and still have a meaningful scaled down thumbnail.
I know paperclip can do either crop or resize, but is there a way to combine both?
Edit: To clarify, I’m not trying to create a cropper tool where the user can interact and crop the image. For every photo that is uploaded, I want to uniformly perform a crop followed by a resize.
Thanks
There’s probably a better way of doing this, but if you’re using ImageMagick this way works fine.
The following will first crop in the center of the image at 500×500, then throw everything else away, then resize that new image back down to 100×100.