From 59f8eeb290bd51309846c224efb5021513c22c4b Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 21 Dec 2019 01:17:08 +0300 Subject: [PATCH] add release notes --- docs/releasenotes/7.0.0.rst | 27 +++++++++++++++++++++++++++ src/PIL/Image.py | 12 ++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/docs/releasenotes/7.0.0.rst b/docs/releasenotes/7.0.0.rst index 08933eaf8..1b2067907 100644 --- a/docs/releasenotes/7.0.0.rst +++ b/docs/releasenotes/7.0.0.rst @@ -94,6 +94,33 @@ Custom unidentified image error Pillow will now throw a custom ``UnidentifiedImageError`` when an image cannot be identified. For backwards compatibility, this will inherit from ``IOError``. +New argument ``reducing_gap`` for Image.resize() and Image.thumbnail() methods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Speeds up resizing by resizing the image in two steps. The bigger ``reducing_gap``, +the closer the result to the fair resampling. The smaller ``reducing_gap``, +the faster resizing. With ``reducing_gap`` greater or equal to 3.0 result is +indistinguishable from fair resampling. + +The default value for :py:meth:`~PIL.Image.Image.resize` is ``None``, +which means that the optimization is turned off by default. + +The default value for :py:meth:`~PIL.Image.Image.thumbnail` is 2.0, +which is very close to fair resampling while still faster in many cases. +In addition, the same gap is applied when :py:meth:`~PIL.Image.Image.thumbnail` +calls :py:meth:`~PIL.Image.Image.draft`, which could greatly improve the quality +of JPEG thumbnails. As a result, :py:meth:`~PIL.Image.Image.thumbnail` +in the new version provides equally high speed and high quality from any +sources (JPEG or arbitrary images). + +New Image.reduce() method +^^^^^^^^^^^^^^^^^^^^^^^^^ + +:py:meth:`~PIL.Image.Image.reduce` is a highly efficient operation +to reduce an image by integer times. Normally, shouldn't be used directly. +Used internally by :py:meth:`~PIL.Image.Image.resize` and :py:meth:`~PIL.Image.Image.thumbnail` +methods to speed up resize when a new argument ``reducing_gap`` is set. + Other Changes ============= diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 285bdf402..92563e832 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1808,10 +1808,10 @@ class Image: Second, resizing using regular resampling. The last step changes size not less than in ``reducing_gap`` times. ``reducing_gap`` could be None (no first step is performed) - or should be greater than 1.0. The bigger `reducing_gap`, + or should be greater than 1.0. The bigger ``reducing_gap``, the closer the result to the fair resampling. - The smaller `reducing_gap`, the faster resizing. - With `reducing_gap` greater or equal to 3.0 result is + The smaller ``reducing_gap``, the faster resizing. + With ``reducing_gap`` greater or equal to 3.0 result is indistinguishable from fair resampling in most cases. The default value is None (no optimization). :returns: An :py:class:`~PIL.Image.Image` object. @@ -2223,10 +2223,10 @@ class Image: Second, resizing using regular resampling. The last step changes size not less than in ``reducing_gap`` times. ``reducing_gap`` could be None (no first step is performed) - or should be greater than 1.0. The bigger `reducing_gap`, + or should be greater than 1.0. The bigger ``reducing_gap``, the closer the result to the fair resampling. - The smaller `reducing_gap`, the faster resizing. - With `reducing_gap` greater or equal to 3.0 result is + The smaller ``reducing_gap``, the faster resizing. + With ``reducing_gap`` greater or equal to 3.0 result is indistinguishable from fair resampling in most cases. The default value is 2.0 (very close to fair resampling while still faster in many cases).