I've had problems saving MxNx3 (RGB) numpy arrays as images using imsave. It fails with an exception, and the problem seems to be line 1243 in image.py:
figsize = [x / float(dpi) for x in arr.shape[::-1]] The purpose of arr.shape[::-1] seems to be to reorder the height and width dimensions. It works as intended for MxN arrays, but not NxMx3 arrays -- they cause a function to complain about an argument too many. I have modified the above line to use (arr.shape[1], arr.shape[0]) instead of arr.shape[::-1], and that solves the problem for me, and I get the output I expect (and the code still passes all tests it should pass). However, there could very well be subtleties in the codebase that I don't know about. The attached patches add a simple test case, the above mentioned change and a few updates to the documentation of imsave. Best, Jostein.
0001-Add-test-for-color-alpha-handling-in-imsave.patch
Description: Binary data
0002-Fix-imsave-to-accept-a-third-color-alpha-dimension.patch
Description: Binary data
------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel