matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

ResizeToFill processor crops without resizing #516

Closed mrwormhole closed 3 years ago

mrwormhole commented 3 years ago

ResizeToFill doesn't work properly, it crops the images with the ratio. How do I do image resizing without cropping as PIL does? there is not enough info at docs

mrwormhole commented 3 years ago

Would be good if there were examples for each processor so people wouldn't need to try each of them.

Base

'ProcessorPipeline', 'Adjust', 'Reflection', 'Transpose', 'Anchor', 'MakeOpaque',

Crop

'TrimBorderColor', 'Crop', 'SmartCrop',

Resize

'Resize', 'ResizeToCover', 'ResizeToFill', 'SmartResize', 'ResizeCanvas', 'AddBorder', 'ResizeToFit', 'Thumbnail'

After trying all the options that are provided "ResizeCanvas" worked for proper resizing for a given width and height without cropping like autistic

vstoykov commented 3 years ago

ResizeToFit will not crop. ResizeToFill will crop because it's impossible to fill if the ratio of the image and the desired size are different.

haowu0802 commented 2 years ago

Here's a list of the resizers used in the processor, it's pretty clear what each of them do in the comments:

https://github.com/matthewwithanm/pilkit/blob/master/pilkit/processors/resize.py