Permalink
Browse files

Merge pull request #963 from cgohlke/patch-1

Add detection of file extension for file-like objects
  • Loading branch information...
2 parents 2c85848 + 78ba714 commit cbb11da327ae48c790b908ed731d9fe49cfd7f12 @WeatherGod WeatherGod committed Jul 18, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/matplotlib/image.py
View
@@ -1170,6 +1170,9 @@ def pilread():
if cbook.is_string_like(fname):
basename, ext = os.path.splitext(fname)
ext = ext.lower()[1:]
+ elif hasattr(fname, 'name'):
+ basename, ext = os.path.splitext(fname.name)
+ ext = ext.lower()[1:]
else:
ext = 'png'
else:

0 comments on commit cbb11da

Please sign in to comment.