mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-05 13:21:12 +08:00
Fix handling of tiffile handles
This commit is contained in:
@@ -5,7 +5,7 @@ from six import string_types
|
||||
from PIL import Image
|
||||
|
||||
from ...util import img_as_ubyte, img_as_uint
|
||||
from ...external.tifffile import imread as tif_imread, imsave as tif_imsave
|
||||
from ...external.tifffile import TiffFile, imsave as tif_imsave
|
||||
|
||||
|
||||
def imread(fname, dtype=None, img_num=None, **kwargs):
|
||||
@@ -42,7 +42,8 @@ def imread(fname, dtype=None, img_num=None, **kwargs):
|
||||
kwargs.setdefault('key', img_num)
|
||||
if fname.lower().endswith(('.tiff', '.tif')):
|
||||
with open(fname, 'rb') as f:
|
||||
return tif_imread(f, **kwargs)
|
||||
tif = TiffFile(f)
|
||||
return tif.asarray(**kwargs)
|
||||
|
||||
if isinstance(fname, string_types):
|
||||
with open(fname, 'rb') as f:
|
||||
|
||||
Reference in New Issue
Block a user