Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5417 from radarhere/contain
Added ImageOps contain()
- Loading branch information
Showing
5 changed files
with
119 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
8.3.0 | ||
----- | ||
|
||
Deprecations | ||
============ | ||
|
||
TODO | ||
^^^^ | ||
|
||
TODO | ||
|
||
API Changes | ||
=========== | ||
|
||
Changed WebP default "method" value when saving | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Previously, it was 0, for the best speed. The default has now been changed to 4, to | ||
match WebP's default, for higher quality with still some speed optimisation. | ||
|
||
Default resampling filter for special image modes | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Pillow 7.0 changed the default resampling filter to ``Image.BICUBIC``. However, as this | ||
is not supported yet for images with a custom number of bits, the default filter for | ||
those modes has been reverted to ``Image.NEAREST``. | ||
|
||
ImageMorph incorrect mode errors | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
For ``apply()``, ``match()`` and ``get_on_pixels()``, if the image mode is not L, an | ||
:py:exc:`Exception` was thrown. This has now been changed to a :py:exc:`ValueError`. | ||
|
||
API Additions | ||
============= | ||
|
||
ImageOps.contain | ||
^^^^^^^^^^^^^^^^ | ||
|
||
Returns a resized version of the image, set to the maximum width and height within | ||
``size``, while maintaining the original aspect ratio. | ||
|
||
To compare it to other ImageOps methods: | ||
|
||
- :py:meth:`~PIL.ImageOps.fit` expands an image until is fills ``size``, cropping the | ||
parts of the image that do not fit. | ||
- :py:meth:`~PIL.ImageOps.pad` expands an image to fill ``size``, without cropping, but | ||
instead filling the extra space with ``color``. | ||
- :py:meth:`~PIL.ImageOps.contain` is similar to :py:meth:`~PIL.ImageOps.pad`, but it | ||
does not fill the extra space. Instead, the original aspect ratio is maintained. So | ||
unlike the other two methods, it is not guaranteed to return an image of ``size``. | ||
|
||
Security | ||
======== | ||
|
||
TODO | ||
|
||
Other Changes | ||
============= | ||
|
||
TODO | ||
^^^^ | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ expected to be backported to earlier versions. | |
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
8.3.0 | ||
8.2.0 | ||
8.1.2 | ||
8.1.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters