Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/matplotlib/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,17 @@ def test_image_python_io():
def test_imshow_pil(fig_test, fig_ref):
style.use("default")
PIL = pytest.importorskip("PIL")
png_path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png"
tiff_path = Path(__file__).parent / "baseline_images/test_image/uint16.tif"
# Pillow<=6.0 fails to open pathlib.Paths on Windows (pillow#3823), and
# Matplotlib's builtin png opener doesn't handle them either.
png_path = str(
Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png")
tiff_path = str(
Path(__file__).parent / "baseline_images/test_image/uint16.tif")
axs = fig_test.subplots(2)
axs[0].imshow(PIL.Image.open(png_path))
axs[1].imshow(PIL.Image.open(tiff_path))
axs = fig_ref.subplots(2)
axs[0].imshow(plt.imread(str(png_path)))
axs[0].imshow(plt.imread(png_path))
axs[1].imshow(plt.imread(tiff_path))


Expand Down