The output image size should be 800x200 or smaller. How to achieve the following?
- If the source image is smaller in both dimensions, do not modify.
- If the source image is larger in both dimensions, then first resize to the larger side keeping aspect ratio. Then crop. So, 1000x500 is resized to 800x400, then cropped (around the center) to 800x200.
- If the source image is larger in one dimension, then crop to 800x200.
Working in Rails with Paperclip.