From 3f12aef7ede0044fb03ed0a982128b84f021e9a0 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 16 Jul 2011 18:44:25 +0200 Subject: [PATCH] Fix bug with 2D images --- scikits/image/io/_plugins/util.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scikits/image/io/_plugins/util.py b/scikits/image/io/_plugins/util.py index b21dae45..2f37074c 100644 --- a/scikits/image/io/_plugins/util.py +++ b/scikits/image/io/_plugins/util.py @@ -135,14 +135,15 @@ def prepare_for_display(npy_img): if npy_img.ndim == 2 or \ (npy_img.ndim == 3 and npy_img.shape[2] == 1): + npy_plane = npy_img.reshape((height, width)) if np.issubdtype(npy_img.dtype, float): - out[:,:,0] = npy_img*255 + out[:,:,0] = npy_plane*255 out[:,:,1] = out[:,:,0] out[:,:,2] = out[:,:,0] else: - out[:,:,0] = npy_img - out[:,:,1] = npy_img - out[:,:,2] = npy_img + out[:,:,0] = npy_plane + out[:,:,1] = npy_plane + out[:,:,2] = npy_plane elif npy_img.ndim == 3: if npy_img.shape[2] == 3 or npy_img.shape[2] == 4: