File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -627,15 +627,7 @@ def set_data(self, A):
627627 ----------
628628 A : array-like
629629 """
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 )
639631
640632 if (self ._A .dtype != np .uint8 and
641633 not np .can_cast (self ._A .dtype , float , "same_kind" )):
Original file line number Diff line number Diff line change 1616 rc_context , rcParams )
1717from matplotlib .image import (AxesImage , BboxImage , FigureImage ,
1818 NonUniformImage , PcolorImage )
19- from matplotlib .testing .decorators import image_comparison
19+ from matplotlib .testing .decorators import check_figures_equal , image_comparison
2020from matplotlib .transforms import Bbox , Affine2D , TransformedBbox
2121
2222import pytest
@@ -104,6 +104,15 @@ def test_image_python_io():
104104 plt .imread (buffer )
105105
106106
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+
107116def test_imread_pil_uint16 ():
108117 pytest .importorskip ("PIL" )
109118 img = plt .imread (os .path .join (os .path .dirname (__file__ ),
You can’t perform that action at this time.
0 commit comments