while working on the scikits-image io plugin system, I noticed some issues with matplotlib's imread function. I have a patch for all these issues and will submit a PR but wanted to check on the list first.
1) imread does not properly detect the file type if an open file handle is used.
lena = pylab.imread(matplotlib.cbook.get_sample_data('lena.jpg'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "X:\Python27\lib\site-packages\matplotlib\pyplot.py", line 1740, in imread
return _imread(*args, **kwargs)
File "X:\Python27\lib\site-packages\matplotlib\image.py", line 1207, in imread
RuntimeError: _image_module::readpng: file not recognized as a PNG file
2) imread does not properly convert uint16 images to uint8 as reported on the scikits-image ML <https://groups.google.com/forum/#!topic/scikits-image/O47tNU01kLA>.
3) Any non-PNG image loaded with imread is displayed upside-down in imshow:
A solution is to pass `origin='lower'` to imshow for non-PNG images. But is there a reason for this asymmetry? Any image loaded with PIL is explicitly flipped upside-down at <https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/image.py#L1267>.