-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimise ImageOps.fit by combining resize and crop #3409
Conversation
Let's remember to add this to the release notes. |
@hugovk Added release notes. Could you check? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
docs/releasenotes/5.4.0.rst
Outdated
ImageOps.fit | ||
^^^^^^^^^^^^ | ||
|
||
Now uses the one resize operation with ``box`` argument internally |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now uses the one resize operation with ``box`` argument internally | |
Now uses one resize operation with ``box`` argument internally |
docs/releasenotes/5.4.0.rst
Outdated
^^^^^^^^^^^^ | ||
|
||
Now uses the one resize operation with ``box`` argument internally | ||
instead of the crop and scale operations sequence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the crop and scale operations sequence. | |
instead of a crop and scale sequence. |
docs/releasenotes/5.4.0.rst
Outdated
Now uses the one resize operation with ``box`` argument internally | ||
instead of the crop and scale operations sequence. | ||
This improves the performance and accuracy of cropping since | ||
``box`` parameter accepts float values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``box`` parameter accepts float values. | |
the ``box`` parameter accepts float values. |
This optimises crop+resize operations sequence by using
box
parameter ofresize
function. This gives us:Before:
After:
box
for resize method accepts float coordinates. For example:Source image (50x30px), processed image before, processed image after: