Skip to content

Commit 1469e43

Browse files
authored
Merge pull request #7665 from hugovk/update-release-notes
Release notes: add `ImageColor` and `ImageMode` optimisations, and type hints
2 parents c7a1ce1 + ea4fde8 commit 1469e43

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

docs/PIL.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ can be found here.
6969
:undoc-members:
7070
:show-inheritance:
7171

72+
:mod:`~PIL.ImageMode` Module
73+
----------------------------
74+
75+
.. automodule:: PIL.ImageMode
76+
:members:
77+
:undoc-members:
78+
:show-inheritance:
79+
7280
:mod:`~PIL.ImageTransform` Module
7381
---------------------------------
7482

docs/releasenotes/10.2.0.rst

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
10.2.0
22
------
33

4-
Backwards Incompatible Changes
5-
==============================
6-
7-
TODO
8-
^^^^
9-
10-
TODO
11-
124
Deprecations
135
============
146

@@ -118,16 +110,43 @@ Saving TIFF tag RowsPerStrip
118110
When saving TIFF images, the TIFF tag RowsPerStrip can now be one of the tags set by
119111
the user, rather than always being calculated by Pillow.
120112

113+
Optimized ImageColor.getrgb and getcolor
114+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
115+
116+
The color calculations of :py:attr:`~PIL.ImageColor.getrgb` and
117+
:py:attr:`~PIL.ImageColor.getcolor` are now cached using
118+
:py:func:`functools.lru_cache`. Cached calls of ``getrgb`` are 3.1 - 91.4 times
119+
as fast and ``getcolor`` are 5.1 - 19.6 times as fast.
120+
121+
Optimized ImageMode.getmode
122+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
123+
124+
The lookups made by :py:attr:`~PIL.ImageMode.getmode` are now cached using
125+
:py:func:`functools.lru_cache` instead of a custom cache. Cached calls are 1.2 times as
126+
fast.
127+
121128
Optimized ImageStat.Stat count and extrema
122129
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123130

124131
Calculating the :py:attr:`~PIL.ImageStat.Stat.count` and
125132
:py:attr:`~PIL.ImageStat.Stat.extrema` statistics is now faster. After the
126-
histogram is created in ``st = ImageStat.Stat(im)``, ``st.count`` is 3x as fast
127-
on average and ``st.extrema`` is 12x as fast on average.
133+
histogram is created in ``st = ImageStat.Stat(im)``, ``st.count`` is 3 times as fast on
134+
average and ``st.extrema`` is 12 times as fast on average.
128135

129136
Encoder errors now report error detail as string
130137
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131138

132139
:py:exc:`OSError` exceptions from image encoders now include a textual description of
133140
the error instead of a numeric error code.
141+
142+
Type hints
143+
^^^^^^^^^^
144+
145+
Work has begun to add type annotations to Pillow, including:
146+
147+
* :py:mod:`~PIL.ContainerIO`
148+
* :py:mod:`~PIL.FontFile`, :py:mod:`~PIL.BdfFontFile` and :py:mod:`~PIL.PcfFontFile`
149+
* :py:mod:`~PIL.ImageChops`
150+
* :py:mod:`~PIL.ImageMode`
151+
* :py:mod:`~PIL.ImageSequence`
152+
* :py:mod:`~PIL.TarIO`

0 commit comments

Comments
 (0)