I'm using easy-thumbnails to make thumbnails for my site. I want to create a thumbnail from an image that's 1500x1023px. The size of the desired thumbnail is 100x100px. What I want is for the thumbnail to show the entire logo rather than cropping or stretching. I've seen this referred to as a padded fit - kind the opposite of a crop. For example, for this image, we'd add 236px of whitespace on the top and 237px of whitespace on the bottom and then resize. Is there any way to do this with easy-thumbnails? If not, any suggestions on how to approach this? Thanks!
Padded fit with easy thumbnails
1.8k Views Asked by Josh At
2
There are 2 best solutions below
2

Thanks a lot for that answer, Josh! This is exactly what I was looking for since a few weeks. However, your solution mysteriously doesn't work on some images.
Here is a (fully functionnal) revised version of that thumbnail processor: https://bitbucket.org/bercab/cmsplugin-nivoslider/src/b07db53c1ce4/cmsplugin_nivoslider/thumbnail_processors.py
Thanks for Timmy O'Mahony's suggestion of creating a processor to do the padding. Here's the code for those of you that come up against a similar issue. To get this to work, you'll need something like this in settings:
And then you can add this to common/thumbnail_processors.py (or wherever)