4
4
Deprecations
5
5
============
6
6
7
- Tk/Tcl 8.4
8
- ^^^^^^^^^^
9
-
10
- Support for Tk/Tcl 8.4 is deprecated and will be removed in Pillow 10.0.0 (2023-01-02),
11
- when Tk/Tcl 8.5 will be the minimum supported.
12
-
13
7
Categories
14
8
^^^^^^^^^^
15
9
@@ -20,6 +14,12 @@ along with the related ``Image.NORMAL``, ``Image.SEQUENCE`` and
20
14
To determine if an image has multiple frames or not,
21
15
``getattr(im, "is_animated", False) `` can be used instead.
22
16
17
+ Tk/Tcl 8.4
18
+ ^^^^^^^^^^
19
+
20
+ Support for Tk/Tcl 8.4 is deprecated and will be removed in Pillow 10.0.0 (2023-01-02),
21
+ when Tk/Tcl 8.5 will be the minimum supported.
22
+
23
23
API Changes
24
24
===========
25
25
@@ -48,14 +48,28 @@ These changes only affect :py:meth:`~PIL.Image.Image.getexif`, introduced in Pil
48
48
Image._MODEINFO
49
49
^^^^^^^^^^^^^^^
50
50
51
- This internal dictionary has been deprecated by a comment since PIL, and is now
51
+ This internal dictionary had been deprecated by a comment since PIL, and is now
52
52
removed. Instead, ``Image.getmodebase() ``, ``Image.getmodetype() ``,
53
53
``Image.getmodebandnames() ``, ``Image.getmodebands() `` or ``ImageMode.getmode() ``
54
54
can be used.
55
55
56
56
API Additions
57
57
=============
58
58
59
+ getxmp() for JPEG images
60
+ ^^^^^^^^^^^^^^^^^^^^^^^^
61
+
62
+ A new method has been added to return
63
+ `XMP data <https://en.wikipedia.org/wiki/Extensible_Metadata_Platform >`_ for JPEG
64
+ images. It reads the XML data into a dictionary of names and values.
65
+
66
+ For example::
67
+
68
+ >>> from PIL import Image
69
+ >>> with Image.open("Tests/images/xmp_test.jpg") as im:
70
+ >>> print(im.getxmp())
71
+ {'RDF': {}, 'Description': {'Version': '10.4', 'ProcessVersion': '10.0', ...}, ...}
72
+
59
73
ImageDraw.rounded_rectangle
60
74
^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
75
@@ -71,17 +85,13 @@ create a circle, but not any other ellipse.
71
85
draw = ImageDraw.Draw(im)
72
86
draw.rounded_rectangle(xy = (10 , 20 , 190 , 180 ), radius = 30 , fill = " red" )
73
87
74
- ImageShow.IPythonViewer
75
- ^^^^^^^^^^^^^^^^^^^^^^^
76
-
77
- If IPython is present, this new :py:class: `PIL.ImageShow.Viewer ` subclass will be
78
- registered. It displays images on all IPython frontends. This will be helpful
79
- to users of Google Colab, allowing ``im.show() `` to display images.
88
+ ImageOps.autocontrast: preserve_tone
89
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80
90
81
- It is lower in priority than the other default :py:class: ` PIL.ImageShow.Viewer `
82
- instances, so it will only be used by `` im.show() `` or :py:func: ` .ImageShow.show() `
83
- if none of the other viewers are available. This means that the behaviour of
84
- :py:class: ` PIL.ImageShow ` will stay the same for most Pillow users .
91
+ The default behaviour of :py:meth: ` ~ PIL.ImageOps.autocontrast ` is to normalize
92
+ separate histograms for each color channel, changing the tone of the image. The new
93
+ `` preserve_tone `` argument keeps the tone unchanged by using one luminance histogram
94
+ for all channels .
85
95
86
96
ImageShow.GmDisplayViewer
87
97
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -95,6 +105,18 @@ counterpart. Thus, if both ImageMagick and GraphicsMagick are installed,
95
105
ImageMagick, i.e the behaviour stays the same for Pillow users having
96
106
ImageMagick installed.
97
107
108
+ ImageShow.IPythonViewer
109
+ ^^^^^^^^^^^^^^^^^^^^^^^
110
+
111
+ If IPython is present, this new :py:class: `PIL.ImageShow.Viewer ` subclass will be
112
+ registered. It displays images on all IPython frontends. This will be helpful
113
+ to users of Google Colab, allowing ``im.show() `` to display images.
114
+
115
+ It is lower in priority than the other default :py:class: `PIL.ImageShow.Viewer `
116
+ instances, so it will only be used by ``im.show() `` or :py:func: `.ImageShow.show() `
117
+ if none of the other viewers are available. This means that the behaviour of
118
+ :py:class: `PIL.ImageShow ` will stay the same for most Pillow users.
119
+
98
120
Saving TIFF with ICC profile
99
121
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100
122
@@ -104,32 +126,59 @@ be specified through a keyword argument::
104
126
im.save("out.tif", icc_profile=...)
105
127
106
128
107
- ImageOps.autocontrast: preserve_tone
108
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
+ Security
130
+ ========
109
131
110
- The default behaviour of :py:meth: `~PIL.ImageOps.autocontrast ` is to normalize
111
- separate histograms for each color channel, changing the tone of the image. The new
112
- ``preserve_tone `` argument keeps the tone unchanged by using one luminance histogram
113
- for all channels.
132
+ These were all found with `OSS-Fuzz `_.
114
133
115
- getxmp() for JPEG images
116
- ^^^^^^^^^^^^^^^^^^^^^^^^
134
+ :cve: ` CVE-2021-25287 `, :cve: ` CVE-2021-25288 `: Fix OOB read in Jpeg2KDecode
135
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
136
118
- A new method has been added to return
119
- ` XMP data < https://en.wikipedia.org/wiki/Extensible_Metadata_Platform >`_ for JPEG
120
- images. It reads the XML data into a dictionary of names and values .
137
+ * For J2k images with multiple bands, it's legal to have different widths for each band,
138
+ e.g. 1 byte for `` L ``, 4 bytes for `` A ``.
139
+ * This dates to Pillow 2.4.0 .
121
140
122
- For example::
141
+ :cve: `CVE-2021-28675 `: Fix DOS in PsdImagePlugin
142
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123
143
124
- >>> from PIL import Image
125
- >>> with Image.open("Tests/images/xmp_test.jpg") as im:
126
- >>> print(im.getxmp())
127
- {'RDF': {}, 'Description': {'Version': '10.4', 'ProcessVersion': '10.0', ...}, ...}
144
+ * :py:class: `.PsdImagePlugin.PsdImageFile ` did not sanity check the number of input
145
+ layers with regard to the size of the data block, this could lead to a
146
+ denial-of-service on :py:meth: `~PIL.Image.open ` prior to
147
+ :py:meth: `~PIL.Image.Image.load `.
148
+ * This dates to the PIL fork.
128
149
129
- Security
130
- ========
150
+ :cve: `CVE-2021-28676 `: Fix FLI DOS
151
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152
+
153
+ * ``FliDecode.c `` did not properly check that the block advance was non-zero,
154
+ potentially leading to an infinite loop on load.
155
+ * This dates to the PIL fork.
156
+
157
+ :cve: `CVE-2021-28677 `: Fix EPS DOS on _open
158
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131
159
132
- TODO
160
+ * The readline used in EPS has to deal with any combination of ``\r `` and ``\n `` as line
161
+ endings. It accidentally used a quadratic method of accumulating lines while looking
162
+ for a line ending.
163
+ * A malicious EPS file could use this to perform a denial-of-service of Pillow in the
164
+ open phase, before an image was accepted for opening.
165
+ * This dates to the PIL fork.
166
+
167
+ :cve: `CVE-2021-28678 `: Fix BLP DOS
168
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169
+
170
+ * ``BlpImagePlugin `` did not properly check that reads after jumping to file offsets
171
+ returned data. This could lead to a denial-of-service where the decoder could be run a
172
+ large number of times on empty data.
173
+ * This dates to Pillow 5.1.0.
174
+
175
+ Fix memory DOS in ImageFont
176
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
177
+
178
+ * A corrupt or specially crafted TTF font could have font metrics that lead to
179
+ unreasonably large sizes when rendering text in font. ``ImageFont.py `` did not check
180
+ the image size before allocating memory for it.
181
+ * This dates to the PIL fork.
133
182
134
183
Other Changes
135
184
=============
@@ -146,6 +195,12 @@ The pixel data is encoded using the format specified in the `CompuServe GIF stan
146
195
The older encoder used a variant of run-length encoding that was compatible but less
147
196
efficient.
148
197
198
+ GraphicsMagick
199
+ ^^^^^^^^^^^^^^
200
+
201
+ The test suite can now be run on systems which have GraphicsMagick _ but not
202
+ ImageMagick _ installed. If both are installed, the tests prefer ImageMagick.
203
+
149
204
Libraqm and FriBiDi linking
150
205
^^^^^^^^^^^^^^^^^^^^^^^^^^^
151
206
@@ -170,11 +225,6 @@ PyQt6
170
225
Support has been added for PyQt6. If it is installed, it will be used instead of
171
226
PySide6, PyQt5 or PySide2.
172
227
173
- GraphicsMagick
174
- ^^^^^^^^^^^^^^
175
-
176
- The test suite can now be run on systems which have GraphicsMagick _ but not
177
- ImageMagick _ installed. If both are installed, the tests prefer ImageMagick.
178
-
179
228
.. _GraphicsMagick : http://www.graphicsmagick.org/
180
229
.. _ImageMagick : https://imagemagick.org/
230
+ .. _OSS-Fuzz : https://github.com/google/oss-fuzz
0 commit comments