File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,26 @@ def test_imsave():
128
128
129
129
assert_array_equal (arr_dpi1 , arr_dpi100 )
130
130
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
+
131
151
@image_comparison (baseline_images = ['image_clip' ])
132
152
def test_image_clip ():
133
153
from math import pi
You can’t perform that action at this time.
0 commit comments