From efefbc57d2a836887fbf142e5fdba8093408cf3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20B=C3=B8=20Fl=C3=B8ystad?= <jostein.floystad@gmail.com>
Date: Sat, 7 Apr 2012 16:37:17 +0200
Subject: [PATCH 1/2] Add test for color/alpha handling in imsave.

---
 lib/matplotlib/tests/test_image.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
index 87aa2cb..6846323 100644
--- a/lib/matplotlib/tests/test_image.py
+++ b/lib/matplotlib/tests/test_image.py
@@ -114,6 +114,16 @@ def test_imsave():
 
     assert_array_equal(arr_dpi1, arr_dpi100)
 
+def test_imsave_color_alpha():
+    # The goal is to test that imsave will accept arrays with ndim=3 where
+    # the third dimension is color and alpha without raising any exceptions
+    from numpy import random
+    random.seed(1)
+    data = random.rand(256, 128, 4)
+
+    buff = io.BytesIO()
+    plt.imsave(buff, data)
+
 @image_comparison(baseline_images=['image_clip'])
 def test_image_clip():
     from math import pi
-- 
1.7.5.4

