Skip to content

Commit cbb11da

Browse files
committed
Merge pull request #963 from cgohlke/patch-1
Add detection of file extension for file-like objects
2 parents 2c85848 + 78ba714 commit cbb11da

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/image.py

+3
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,9 @@ def pilread():
11701170
if cbook.is_string_like(fname):
11711171
basename, ext = os.path.splitext(fname)
11721172
ext = ext.lower()[1:]
1173+
elif hasattr(fname, 'name'):
1174+
basename, ext = os.path.splitext(fname.name)
1175+
ext = ext.lower()[1:]
11731176
else:
11741177
ext = 'png'
11751178
else:

0 commit comments

Comments
 (0)