Merge branch 'issue159' into devel
This commit is contained in:
commit
4d4ecac166
1 changed files with 13 additions and 0 deletions
|
|
@ -772,6 +772,19 @@ class Jp2k(Jp2kBox):
|
||||||
"""
|
"""
|
||||||
self._subsampling_sanity_check()
|
self._subsampling_sanity_check()
|
||||||
|
|
||||||
|
# Must check the specified rlevel against the maximum.
|
||||||
|
if rlevel != 0:
|
||||||
|
# Must check the specified rlevel against the maximum.
|
||||||
|
codestream = self.get_codestream()
|
||||||
|
max_rlevel = codestream.segment[2].spcod[4]
|
||||||
|
if rlevel == -1:
|
||||||
|
# -1 is shorthand for the largest rlevel
|
||||||
|
rlevel = max_rlevel
|
||||||
|
elif rlevel < -1 or rlevel > max_rlevel:
|
||||||
|
msg = "rlevel must be in the range [-1, {0}] for this image."
|
||||||
|
msg = msg.format(max_rlevel)
|
||||||
|
raise IOError(msg)
|
||||||
|
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
try:
|
try:
|
||||||
# Set decoding parameters.
|
# Set decoding parameters.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue