progress
This commit is contained in:
parent
e446cb1577
commit
e165edbe53
2 changed files with 19 additions and 9 deletions
|
|
@ -14,15 +14,12 @@ retrieve a full resolution and first lower-resolution image ::
|
|||
>>> jp2file = glymur.data.nemo() # just a path to a JPEG2000 file
|
||||
>>> jp2 = glymur.Jp2k(jp2file)
|
||||
>>> fullres = jp2[:]
|
||||
>>> print(fullres.shape)
|
||||
>>> fullres.shape
|
||||
(1456, 2592, 3)
|
||||
>>> thumbnail = jp2[::2, ::2]
|
||||
>>> print(thumbnail.shape)
|
||||
>>> thumbnail.shape
|
||||
(728, 1296, 3)
|
||||
|
||||
The :py:meth:`read` method exposes many more options for other JPEG 2000
|
||||
features such as quality layers.
|
||||
|
||||
... write images?
|
||||
=================
|
||||
It's pretty simple, just supply the image data as the 2nd argument to the Jp2k
|
||||
|
|
|
|||
|
|
@ -345,11 +345,24 @@ class TestJp2k(unittest.TestCase):
|
|||
self.assertEqual(newjp2.filename, self.j2kfile)
|
||||
self.assertEqual(len(newjp2.box), 0)
|
||||
|
||||
@unittest.skip("see issue 302")
|
||||
def test_rlevel_max(self):
|
||||
"""Verify that rlevel=-1 gets us the lowest resolution image"""
|
||||
@unittest.skipIf(WARNING_INFRASTRUCTURE_ISSUE, WARNING_INFRASTRUCTURE_MSG)
|
||||
def test_rlevel_max_backwards_compatibility(self):
|
||||
"""
|
||||
Verify that rlevel=-1 gets us the lowest resolution image
|
||||
|
||||
This is an old option only available via the read method, not via
|
||||
array-style slicing.
|
||||
"""
|
||||
j = Jp2k(self.j2kfile)
|
||||
thumbnail1 = j.read(rlevel=-1)
|
||||
if sys.hexversion < 0x03000000:
|
||||
with warnings.catch_warnings():
|
||||
# Suppress a warning due to deprecated syntax
|
||||
# Not as easy to verify the warning under python2.
|
||||
warnings.simplefilter("ignore")
|
||||
thumbnail1 = j.read(rlevel=-1)
|
||||
else:
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
thumbnail1 = j.read(rlevel=-1)
|
||||
thumbnail2 = j[::32, ::32]
|
||||
np.testing.assert_array_equal(thumbnail1, thumbnail2)
|
||||
self.assertEqual(thumbnail1.shape, (25, 15, 3))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue