mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 03:11:05 +08:00
Merge pull request #102 from tonysyu/pil-big-endian
BUG: Fix PIL big endian regression.
This commit is contained in:
Binary file not shown.
@@ -23,7 +23,7 @@ def imread(fname, dtype=None):
|
||||
im = im.convert('RGB')
|
||||
elif im.mode == '1':
|
||||
im = im.convert('L')
|
||||
elif im.mode == 'I;16':
|
||||
elif im.mode.startswith('I;16'):
|
||||
shape = im.size
|
||||
dtype = '>u2' if im.mode.endswith('B') else '<u2'
|
||||
im = np.fromstring(im.tostring(), dtype)
|
||||
|
||||
@@ -51,6 +51,14 @@ def test_bilevel():
|
||||
img = imread(os.path.join(data_dir, 'checker_bilevel.png'))
|
||||
assert_array_equal(img, expected)
|
||||
|
||||
@skipif(not PIL_available)
|
||||
def test_imread_uint16():
|
||||
expected = np.load(os.path.join(data_dir, 'chessboard_GRAY_U8.npy'))
|
||||
img = imread(os.path.join(data_dir, 'chessboard_GRAY_U16.tif'))
|
||||
assert img.dtype == np.uint16
|
||||
assert_array_almost_equal(img, expected)
|
||||
|
||||
|
||||
class TestSave:
|
||||
def roundtrip(self, dtype, x, scaling=1):
|
||||
f = NamedTemporaryFile(suffix='.png')
|
||||
|
||||
Reference in New Issue
Block a user