mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
Use context manager for tif imread as well
This commit is contained in:
@@ -41,7 +41,8 @@ def imread(fname, dtype=None, img_num=None, **kwargs):
|
||||
if hasattr(fname, 'lower') and dtype is None:
|
||||
kwargs.setdefault('key', img_num)
|
||||
if fname.lower().endswith(('.tiff', '.tif')):
|
||||
return tif_imread(fname, **kwargs)
|
||||
with open(fname, 'rb') as f:
|
||||
return tif_imread(f, **kwargs)
|
||||
|
||||
if isinstance(fname, string_types):
|
||||
with open(fname, 'rb') as f:
|
||||
|
||||
Reference in New Issue
Block a user