Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/matplotlib/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,8 +1259,10 @@ def pilread(fname):
from PIL import Image
except ImportError:
return None
image = Image.open(fname)
return pil_to_array(image)
with open(fname, 'rb') as f:
image = Image.open(f)
array = pil_to_array(image)
return array

handlers = {'png': _png.read_png, }
if format is None:
Expand Down