Flask-Resize icon indicating copy to clipboard operation
Flask-Resize copied to clipboard

'Fill' fit image instead of cropping

Open WhiteAls opened this issue 8 years ago • 2 comments

Coming from 0.2.2 version (really :D ). The 'fill' argument is acting like "resize to fit", not " resize to fill". Docs says "With fill it will crop the image", but instead it just fill with white color. Here is an example.

0.2.2

7fb59b3b385593414de2d41c1e7c2383 1

2.0.2

394d230a7b2811ebc7de3a935913cdc22f5d5998

WhiteAls avatar Apr 05 '17 14:04 WhiteAls

Heh yeah the version numbering changed quickly for a while there! 😅

I'm not personally relying on fill in production, but there are unit tests that show it's working, at least under the specified conditions.

So perhaps you can create a test case for the problem you're experiencing? Would make it much more to debug.

jacobsvante avatar Apr 19 '17 10:04 jacobsvante

I'm so sorry for so long reply, totally forgot about it due to job change :( My case is very simple, i used this code

<img class="image" src="{{ photo|resize('263x263', fill=1, format='jpg', placeholder=1) }}" alt=""/>

to generate images from op post. The same code for 0.2.2 version and 2.0.2 generates different results, as you see in my examples. Maybe my issue that resizing.py uses Pilkit ResizeToFit method even for "fill" option set (instead of ResizeToFill).

WhiteAls avatar Sep 11 '17 14:09 WhiteAls