1
votes

The output image size should be 800x200 or smaller. How to achieve the following?

  1. If the source image is smaller in both dimensions, do not modify.
  2. 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.
  3. If the source image is larger in one dimension, then crop to 800x200.

Working in Rails with Paperclip.

1

1 Answers

0
votes

Not sure if this handles #1 in the question, but it does #2 and #3.

has_attached_file :picture, 
                  :styles => { :medium => "800x200#" }

Thanks to colli8marko for this!

Simple cropping with Paperclip