File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,6 +128,26 @@ def test_imsave():
128128
129129 assert_array_equal (arr_dpi1 , arr_dpi100 )
130130
131+ def test_imsave_color_alpha ():
132+ # The goal is to test that imsave will accept arrays with ndim=3 where
133+ # the third dimension is color and alpha without raising any exceptions
134+ from numpy import random
135+ random .seed (1 )
136+ data = random .rand (256 , 128 , 4 )
137+
138+ buff = io .BytesIO ()
139+ plt .imsave (buff , data )
140+
141+ buff .seek (0 )
142+ arr_buf = plt .imread (buff )
143+
144+ assert arr_buf .shape == data .shape
145+
146+ # Unfortunately, the AGG process "flattens" the RGBA data
147+ # into an equivalent RGB data with no transparency. So we
148+ # Can't directly compare the arrays like we could in some
149+ # other imsave tests.
150+
131151@image_comparison (baseline_images = ['image_clip' ])
132152def test_image_clip ():
133153 from math import pi
You can’t perform that action at this time.
0 commit comments