Readded jpch, jplh write support. #188
This commit is contained in:
parent
49f7c0e1f6
commit
6060ccd37d
2 changed files with 31 additions and 1 deletions
|
|
@ -728,6 +728,11 @@ class CodestreamHeaderBox(Jp2kBox):
|
|||
msg = self._str_superbox()
|
||||
return msg
|
||||
|
||||
def write(self, fptr):
|
||||
"""Write a codestream header box to file.
|
||||
"""
|
||||
self._write_superbox(fptr)
|
||||
|
||||
@staticmethod
|
||||
def parse(fptr, offset, length):
|
||||
"""Parse codestream header box.
|
||||
|
|
@ -792,7 +797,7 @@ class ColourGroupBox(Jp2kBox):
|
|||
self._dispatch_validation_error(msg, writing=writing)
|
||||
|
||||
def write(self, fptr):
|
||||
"""Write an association box to file.
|
||||
"""Write a colour group box to file.
|
||||
"""
|
||||
self._validate(writing=True)
|
||||
self._write_superbox(fptr)
|
||||
|
|
@ -855,6 +860,11 @@ class CompositingLayerHeaderBox(Jp2kBox):
|
|||
msg = self._str_superbox()
|
||||
return msg
|
||||
|
||||
def write(self, fptr):
|
||||
"""Write a compositing layer header box to file.
|
||||
"""
|
||||
self._write_superbox(fptr)
|
||||
|
||||
@staticmethod
|
||||
def parse(fptr, offset, length):
|
||||
"""Parse compositing layer header box.
|
||||
|
|
|
|||
|
|
@ -110,6 +110,26 @@ class TestJPXWrap(unittest.TestCase):
|
|||
with self.assertRaises(IOError):
|
||||
jp2.wrap(tfile.name, boxes=boxes)
|
||||
|
||||
def test_jpch_jplh(self):
|
||||
"""Write a codestream header, compositing layer header box."""
|
||||
jp2 = Jp2k(self.jp2file)
|
||||
boxes = [jp2.box[idx] for idx in [0, 1, 2, 4]]
|
||||
|
||||
# The ftyp box must be modified to jpx.
|
||||
boxes[1].brand = 'jpx '
|
||||
boxes[1].compatibility_list = ['jp2 ', 'jpxb']
|
||||
|
||||
jpch = glymur.jp2box.CodestreamHeaderBox()
|
||||
boxes.append(jpch)
|
||||
jplh = glymur.jp2box.CompositingLayerHeaderBox()
|
||||
boxes.append(jplh)
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".jpx") as tfile:
|
||||
jpx = jp2.wrap(tfile.name, boxes=boxes)
|
||||
|
||||
self.assertEqual(jpx.box[-2].box_id, 'jpch')
|
||||
self.assertEqual(jpx.box[-1].box_id, 'jplh')
|
||||
|
||||
def test_cgrp(self):
|
||||
"""Write a color group box."""
|
||||
jp2 = Jp2k(self.jp2file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue