File tree 2 files changed +11
-10
lines changed 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -649,15 +649,7 @@ def set_data(self, A):
649
649
----------
650
650
A : array-like
651
651
"""
652
- # check if data is PIL Image without importing Image
653
- if hasattr (A , 'getpixel' ):
654
- if A .mode == 'L' :
655
- # greyscale image, but our logic assumes rgba:
656
- self ._A = pil_to_array (A .convert ('RGBA' ))
657
- else :
658
- self ._A = pil_to_array (A )
659
- else :
660
- self ._A = cbook .safe_masked_invalid (A , copy = True )
652
+ self ._A = cbook .safe_masked_invalid (A , copy = True )
661
653
662
654
if (self ._A .dtype != np .uint8 and
663
655
not np .can_cast (self ._A .dtype , float , "same_kind" )):
Original file line number Diff line number Diff line change 18
18
from matplotlib .cbook import MatplotlibDeprecationWarning
19
19
from matplotlib .image import (AxesImage , BboxImage , FigureImage ,
20
20
NonUniformImage , PcolorImage )
21
- from matplotlib .testing .decorators import image_comparison
21
+ from matplotlib .testing .decorators import check_figures_equal , image_comparison
22
22
from matplotlib .transforms import Bbox , Affine2D , TransformedBbox
23
23
24
24
import pytest
@@ -106,6 +106,15 @@ def test_image_python_io():
106
106
plt .imread (buffer )
107
107
108
108
109
+ @check_figures_equal ()
110
+ def test_imshow_pil (fig_test , fig_ref ):
111
+ pytest .importorskip ("PIL" )
112
+ img = plt .imread (os .path .join (os .path .dirname (__file__ ),
113
+ 'baseline_images' , 'test_image' , 'uint16.tif' ))
114
+ fig_test .subplots ().imshow (img )
115
+ fig_ref .subplots ().imshow (np .asarray (img ))
116
+
117
+
109
118
def test_imread_pil_uint16 ():
110
119
pytest .importorskip ("PIL" )
111
120
img = plt .imread (os .path .join (os .path .dirname (__file__ ),
You can’t perform that action at this time.
0 commit comments