|
13 | 13 | from numpy.testing import assert_array_equal
|
14 | 14 |
|
15 | 15 | from matplotlib import (
|
16 |
| - colors, image as mimage, patches, pyplot as plt, |
| 16 | + colors, image as mimage, patches, pyplot as plt, style, |
17 | 17 | rc_context, rcParams)
|
18 | 18 | from matplotlib.cbook import MatplotlibDeprecationWarning
|
19 | 19 | from matplotlib.image import (AxesImage, BboxImage, FigureImage,
|
@@ -117,11 +117,16 @@ def test_image_python_io():
|
117 | 117 |
|
118 | 118 | @check_figures_equal()
|
119 | 119 | def test_imshow_pil(fig_test, fig_ref):
|
120 |
| - pytest.importorskip("PIL") |
121 |
| - img = plt.imread(os.path.join(os.path.dirname(__file__), |
122 |
| - 'baseline_images', 'test_image', 'uint16.tif')) |
123 |
| - fig_test.subplots().imshow(img) |
124 |
| - fig_ref.subplots().imshow(np.asarray(img)) |
| 120 | + style.use("default") |
| 121 | + PIL = pytest.importorskip("PIL") |
| 122 | + png_path = Path(__file__).parent / "baseline_images/pngsuite/basn3p04.png" |
| 123 | + tiff_path = Path(__file__).parent / "baseline_images/test_image/uint16.tif" |
| 124 | + axs = fig_test.subplots(2) |
| 125 | + axs[0].imshow(PIL.Image.open(png_path)) |
| 126 | + axs[1].imshow(PIL.Image.open(tiff_path)) |
| 127 | + axs = fig_ref.subplots(2) |
| 128 | + axs[0].imshow(plt.imread(str(png_path))) |
| 129 | + axs[1].imshow(plt.imread(tiff_path)) |
125 | 130 |
|
126 | 131 |
|
127 | 132 | def test_imread_pil_uint16():
|
|
0 commit comments