mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
Fix implementation of pil_to_ndarray in MultiImage
This commit is contained in:
committed by
Stefan van der Walt
parent
93c6d010e6
commit
39d9dcf20e
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user