merge branch 'issue281' into devel
This commit is contained in:
commit
08ef7846bb
2 changed files with 10 additions and 1 deletions
|
|
@ -545,7 +545,8 @@ class Jp2k(Jp2kBox):
|
||||||
raise IOError(msg)
|
raise IOError(msg)
|
||||||
|
|
||||||
if img_array.dtype != np.uint8 and img_array.dtype != np.uint16:
|
if img_array.dtype != np.uint8 and img_array.dtype != np.uint16:
|
||||||
msg = "Only uint8 and uint16 images are currently supported."
|
msg = "Only uint8 and uint16 datatypes are currently supported "
|
||||||
|
msg += "when writing."
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
|
||||||
def _determine_colorspace(self, img_array, colorspace=None, **kwargs):
|
def _determine_colorspace(self, img_array, colorspace=None, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -843,6 +843,14 @@ class TestJp2k_write(unittest.TestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_unsupported_datatype(self):
|
||||||
|
"""Should raise a runtime error if trying to write uint32"""
|
||||||
|
data = np.zeros((128, 128), dtype=np.uint32)
|
||||||
|
with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile:
|
||||||
|
with self.assertRaises(RuntimeError):
|
||||||
|
j = Jp2k(tfile.name, 'wb')
|
||||||
|
j.write(data)
|
||||||
|
|
||||||
def test_write_with_version_too_early(self):
|
def test_write_with_version_too_early(self):
|
||||||
"""Should raise a runtime error if trying to write with version 1.3"""
|
"""Should raise a runtime error if trying to write with version 1.3"""
|
||||||
data = np.zeros((128, 128), dtype=np.uint8)
|
data = np.zeros((128, 128), dtype=np.uint8)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue