From: Jostein Bø F. <jos...@gm...> - 2012-04-07 15:26:04
|
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. |