Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8636308

Browse files
committed
Cleanup following using Pillow as universal image reader
1 parent b7e413e commit 8636308

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

INSTALL.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ To run the test suite:
4646
* extract the :file:`lib/matplotlib/tests` or :file:`lib/mpl_toolkits/tests`
4747
directories from the source distribution;
4848
* install test dependencies: `pytest <https://pypi.org/project/pytest>`_,
49-
Pillow, MiKTeX, GhostScript, ffmpeg, avconv, ImageMagick, and `Inkscape
49+
MiKTeX, GhostScript, ffmpeg, avconv, ImageMagick, and `Inkscape
5050
<https://inkscape.org/>`_;
5151
* run ``python -mpytest``.
5252

@@ -126,6 +126,7 @@ Matplotlib requires the following dependencies:
126126
* `cycler <http://matplotlib.org/cycler/>`_ (>= 0.10.0)
127127
* `dateutil <https://pypi.org/project/python-dateutil>`_ (>= 2.1)
128128
* `kiwisolver <https://github.com/nucleic/kiwi>`_ (>= 1.0.0)
129+
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 6.2)
129130
* `pyparsing <https://pyparsing.wikispaces.com/>`_
130131

131132
Optionally, you can also install a number of packages to enable better user
@@ -160,8 +161,6 @@ etc., you can install the following:
160161
<https://libav.org/avconv.html>`_: for saving movies;
161162
* `ImageMagick <https://www.imagemagick.org/script/index.php>`_: for saving
162163
animated gifs;
163-
* `Pillow <https://pillow.readthedocs.io/en/latest/>`_ (>= 3.4): for a larger
164-
selection of image file formats: JPEG, BMP, and TIFF image files;
165164
* `LaTeX <https://miktex.org/>`_ and `GhostScript (>=9.0)
166165
<https://ghostscript.com/download/>`_ : for rendering text with LaTeX.
167166

lib/matplotlib/figure.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,9 +2143,7 @@ def savefig(self, fname, *, transparent=None, **kwargs):
21432143
21442144
pil_kwargs : dict, optional
21452145
Additional keyword arguments that are passed to `PIL.Image.save`
2146-
when saving the figure. Only applicable for formats that are saved
2147-
using Pillow, i.e. JPEG, TIFF, and (if the keyword is set to a
2148-
non-None value) PNG.
2146+
when saving the figure.
21492147
"""
21502148

21512149
kwargs.setdefault('dpi', rcParams['savefig.dpi'])

lib/matplotlib/image.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,8 +1629,9 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
16291629
Parameters
16301630
----------
16311631
infile : str or file-like
1632-
The image file -- must be PNG, or Pillow-readable if you have Pillow_
1633-
installed.
1632+
The image file. Matplotlib relies on Pillow_ for image reading, and
1633+
thus supports a wide range of file formats, including PNG, JPG, TIFF
1634+
and others.
16341635
16351636
.. _Pillow: http://python-pillow.org/
16361637

lib/matplotlib/tests/test_image.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,8 @@ def test_imshow_zoom(fig_test, fig_ref):
220220
def test_imshow_pil(fig_test, fig_ref):
221221
style.use("default")
222222
PIL = pytest.importorskip("PIL")
223-
# Pillow<=6.0 fails to open pathlib.Paths on Windows (pillow#3823), and
224-
# Matplotlib's builtin png opener doesn't handle them either.
225-
png_path = str(
226-
Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png")
227-
tiff_path = str(
228-
Path(__file__).parent / "baseline_images/test_image/uint16.tif")
223+
png_path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
224+
tiff_path = Path(__file__).parent / "baseline_images/test_image/uint16.tif"
229225
axs = fig_test.subplots(2)
230226
axs[0].imshow(PIL.Image.open(png_path))
231227
axs[1].imshow(PIL.Image.open(tiff_path))

0 commit comments

Comments
 (0)