easy-thumbnails icon indicating copy to clipboard operation
easy-thumbnails copied to clipboard

Crop images while fitting inside specified size

Open zhgabor opened this issue 9 years ago • 3 comments

I have not found anything besides to define a CUSTOM THUMBNAIL PROCESSOR to

make images to scale down proportionally and then scale long edge to fit the size then fill it with backgroundcolor

like this selection_986

zhgabor avatar Sep 13 '16 11:09 zhgabor

I'm trying to figure out something like this, too. If i have an image that's 560x960 I would like to scale it to 1080x1080. But what happens is that the scale processor will scale up the image until the height is 1080 but the width would still be less than 1080. If I'm understanding you correctly the idea is to add whitespace (or whatever background color you want) to fit the actual size you want, right? I'm working on a custom tumbnail processor for this but was wondering if there's already a solution for this?

xirdneh avatar Dec 08 '17 18:12 xirdneh

we have exactly similar case where we need to generate Facebook\Tweeter meta-images for e-commerce products. We need aspect ratio ~2:1 and size ~1200x630 with empty space filled with background.

Btw for those ultimately looking for this functionality sorl-thumbnail can do this https://sorl-thumbnail.readthedocs.io/en/latest/template.html?highlight=padding#padding

scorpp avatar Jan 27 '19 08:01 scorpp

easy-thumbnails can do that too: you have to set a background color for the space to be filled in in the processor configuration.

fdemmer avatar Nov 27 '20 00:11 fdemmer