# HG changeset patch # User James Bergstra # Date 1282311084 14400 # Node ID 6a778bca0deca585ad094d669546f99519e5c483 # Parent 06f21a964bd87604569ddb8caa20d7cbe6b25d91 fixed saving in image_tiling.py to work for greyscale and colour images diff -r 06f21a964bd8 -r 6a778bca0dec pylearn/io/image_tiling.py --- a/pylearn/io/image_tiling.py Fri Aug 20 09:30:34 2010 -0400 +++ b/pylearn/io/image_tiling.py Fri Aug 20 09:31:24 2010 -0400 @@ -105,7 +105,13 @@ Returns the PIL image that was saved """ - img = Image.fromarray( tiled_img, 'RGBA') + if tiled_img.ndim==2: + img = Image.fromarray( tiled_img, 'L') + elif tiled_img_ndim==3: + img = Image.fromarray( tiled_img, 'RGBA') + else: + raise TypeError('bad ndim', tiled_img) + img.save(filename) return img