File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -627,15 +627,7 @@ def set_data(self, A):
627
627
----------
628
628
A : array-like
629
629
"""
630
- # check if data is PIL Image without importing Image
631
- if hasattr (A , 'getpixel' ):
632
- if A .mode == 'L' :
633
- # greyscale image, but our logic assumes rgba:
634
- self ._A = pil_to_array (A .convert ('RGBA' ))
635
- else :
636
- self ._A = pil_to_array (A )
637
- else :
638
- self ._A = cbook .safe_masked_invalid (A , copy = True )
630
+ self ._A = cbook .safe_masked_invalid (A , copy = True )
639
631
640
632
if (self ._A .dtype != np .uint8 and
641
633
not np .can_cast (self ._A .dtype , float , "same_kind" )):
Original file line number Diff line number Diff line change 16
16
rc_context , rcParams )
17
17
from matplotlib .image import (AxesImage , BboxImage , FigureImage ,
18
18
NonUniformImage , PcolorImage )
19
- from matplotlib .testing .decorators import image_comparison
19
+ from matplotlib .testing .decorators import check_figures_equal , image_comparison
20
20
from matplotlib .transforms import Bbox , Affine2D , TransformedBbox
21
21
22
22
import pytest
@@ -104,6 +104,15 @@ def test_image_python_io():
104
104
plt .imread (buffer )
105
105
106
106
107
+ @check_figures_equal ()
108
+ def test_imshow_pil (fig_test , fig_ref ):
109
+ pytest .importorskip ("PIL" )
110
+ img = plt .imread (os .path .join (os .path .dirname (__file__ ),
111
+ 'baseline_images' , 'test_image' , 'uint16.tif' ))
112
+ fig_test .subplots ().imshow (img )
113
+ fig_ref .subplots ().imshow (np .asarray (img ))
114
+
115
+
107
116
def test_imread_pil_uint16 ():
108
117
pytest .importorskip ("PIL" )
109
118
img = plt .imread (os .path .join (os .path .dirname (__file__ ),
You can’t perform that action at this time.
0 commit comments