Fix implementation of pil_to_ndarray in MultiImage

This commit is contained in:
Steven Silvester
2014-11-07 15:22:19 +02:00
committed by Stefan van der Walt
parent 93c6d010e6
commit 39d9dcf20e
2 changed files with 10 additions and 5 deletions
+2 -2
View File
@@ -48,7 +48,7 @@ def imread(fname, dtype=None):
return pil_to_ndarray(im, dtype)
def pil_to_ndarray(im, dtype=None):
def pil_to_ndarray(im, dtype=None, close_fid=True):
"""Import a PIL Image object to an ndarray, in memory.
Parameters
@@ -74,7 +74,7 @@ def pil_to_ndarray(im, dtype=None):
elif 'A' in im.mode:
im = im.convert('RGBA')
im = np.array(im, dtype=dtype)
if fp is not None:
if fp is not None and close_fid:
fp.close()
return im