Fix imread from urls on some backends.

Some backends infer the image type from the extension. This fix just adds the extension to the temp filename.
This commit is contained in:
Tony S Yu
2013-04-20 14:57:58 -05:00
parent 7d3594310d
commit 8e0bf8ab8f
+2 -1
View File
@@ -130,7 +130,8 @@ def imread(fname, as_grey=False, plugin=None, flatten=None,
as_grey = flatten
if is_url(fname):
with tempfile.NamedTemporaryFile(delete=False) as f:
_, ext = os.path.splitext(fname)
with tempfile.NamedTemporaryFile(delete=False, suffix=ext) as f:
u = urllib2.urlopen(fname)
f.write(u.read())
img = call_plugin('imread', f.name, plugin=plugin, **plugin_args)