mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 17:45:20 +08:00
Merge pull request #89 from cgohlke/patch-4
BUG: Workaround 16 bit image to numpy array conversion bug in PIL.
This commit is contained in:
@@ -20,7 +20,11 @@ def imread(fname, dtype=None):
|
||||
else:
|
||||
im = im.convert('RGB')
|
||||
|
||||
if 'A' in im.mode:
|
||||
if im.mode == 'I;16':
|
||||
shape = im.size
|
||||
im = np.fromstring(im.tostring(), dtype=np.uint16)
|
||||
im.shape = shape[::-1]
|
||||
elif 'A' in im.mode:
|
||||
im = im.convert('RGBA')
|
||||
|
||||
return np.array(im, dtype=dtype)
|
||||
|
||||
Reference in New Issue
Block a user