scikit-image/scikit-image — pull request #802 by jni (2013-10-28 07:36:41+00:00)
Title: Modify mpl_image_to_rgba to allow RGB input image

mpl_image_to_rgba produces a image of shape (M, N, 3, 4) when the input
image is already RGB. This is understandably confusing for downstream
processes, and this commit fixes it.

Calling "File > save as" in the viewer when the input image was RGB produced the following error:

```python
In [4]: v = viewer.ImageViewer(rgbs[0])
v += CentroPlugin()
v.show()
...:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/nuneziglesiasj/venv/cafe/lib/python2.7/site-packages/scikit_image-0.10dev-py2.7-macosx-10.5-x86_64.egg/skimage/viewer/viewers/core.pyc in save_to_file(self)
191 alpha = alpha[:, :, np.newaxis]
192 composite = (overlay[:, :, :3] * alpha +
--> 193 underlay[:, :, :3] * (1 - alpha))
194 io.imsave(filename, composite)
195

ValueError: operands could not be broadcast together with shapes (669,649,3,4) (669,649,1)
> /Users/nuneziglesiasj/venv/cafe/lib/python2.7/site-packages/scikit_image-0.10dev-py2.7-macosx-10.5-x86_64.egg/skimage/viewer/viewers/core.py(193)save_to_file()
192 composite = (overlay[:, :, :3] * alpha +
--> 193 underlay[:, :, :3] * (1 - alpha))
194 io.imsave(filename, composite)
```