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 @@ -649,15 +649,7 @@ def set_data(self, A):
649649        ---------- 
650650        A : array-like 
651651        """ 
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 )
661653
662654        if  (self ._A .dtype  !=  np .uint8  and 
663655                not  np .can_cast (self ._A .dtype , float , "same_kind" )):
Original file line number Diff line number Diff line change 1818from  matplotlib .cbook  import  MatplotlibDeprecationWarning 
1919from  matplotlib .image  import  (AxesImage , BboxImage , FigureImage ,
2020                              NonUniformImage , PcolorImage )
21- from  matplotlib .testing .decorators  import  image_comparison 
21+ from  matplotlib .testing .decorators  import  check_figures_equal ,  image_comparison 
2222from  matplotlib .transforms  import  Bbox , Affine2D , TransformedBbox 
2323
2424import  pytest 
@@ -106,6 +106,15 @@ def test_image_python_io():
106106    plt .imread (buffer )
107107
108108
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+ 
109118def  test_imread_pil_uint16 ():
110119    pytest .importorskip ("PIL" )
111120    img  =  plt .imread (os .path .join (os .path .dirname (__file__ ),
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments