the main header will be printed by default
This commit is contained in:
parent
c23fe48815
commit
dc2b2bda15
2 changed files with 17 additions and 12 deletions
|
|
@ -13,23 +13,25 @@ def main():
|
|||
Entry point for console script jp2dump.
|
||||
"""
|
||||
|
||||
description = 'Print JPEG2000 metadata.'
|
||||
parser = argparse.ArgumentParser(description=description)
|
||||
kwargs = {'description': 'Print JPEG2000 metadata.',
|
||||
'formatter_class': argparse.ArgumentDefaultsHelpFormatter}
|
||||
parser = argparse.ArgumentParser(**kwargs)
|
||||
|
||||
parser.add_argument('-x', '--noxml',
|
||||
help='Suppress XML.',
|
||||
help='suppress XML',
|
||||
action='store_true')
|
||||
parser.add_argument('-s', '--short',
|
||||
help='Only print box id, offset, and length.',
|
||||
help='only print box id, offset, and length',
|
||||
action='store_true')
|
||||
|
||||
chelp = 'Level of codestream information. 0 suppressed all details, '
|
||||
chelp += '1 prints headers, 2 prints the full codestream'
|
||||
chelp = 'Level of codestream information. 0 suppresses all details, '
|
||||
chelp += '1 prints the main header, 2 prints the full codestream.'
|
||||
parser.add_argument('-c', '--codestream',
|
||||
help=chelp,
|
||||
metavar='LEVEL',
|
||||
nargs=1,
|
||||
type=int,
|
||||
default=[0])
|
||||
default=[1])
|
||||
|
||||
parser.add_argument('filename')
|
||||
|
||||
|
|
|
|||
|
|
@ -1040,10 +1040,11 @@ class ContiguousCodestreamBox(Jp2kBox):
|
|||
msg = Jp2kBox.__str__(self)
|
||||
if _printoptions['short'] is True:
|
||||
return msg
|
||||
if _printoptions['codestream'] is False:
|
||||
if _printoptions['siz']:
|
||||
msg += '\n' + self._indent(str(self.main_header.segment[1]),
|
||||
indent_level=4)
|
||||
return msg
|
||||
|
||||
msg += '\n Main header:'
|
||||
for segment in self.main_header.segment:
|
||||
msg += '\n' + self._indent(str(segment), indent_level=8)
|
||||
|
||||
|
|
@ -3360,7 +3361,7 @@ def get_parseoptions():
|
|||
"""
|
||||
return _parseoptions
|
||||
|
||||
_printoptions = {'short': False, 'xml': True, 'codestream': True}
|
||||
_printoptions = {'short': False, 'xml': True, 'siz': True}
|
||||
|
||||
|
||||
def set_printoptions(**kwargs):
|
||||
|
|
@ -3377,8 +3378,10 @@ def set_printoptions(**kwargs):
|
|||
xml : bool, optional
|
||||
When False, printing of the XML contents of any XML boxes or UUID XMP
|
||||
boxes is suppressed.
|
||||
codestream : bool, optional
|
||||
When False, printing of the codestream contents is suppressed.
|
||||
siz : bool, optional
|
||||
When True, only the SIZ segment is printed. When False, the entire
|
||||
codestream is printed. This option has no effect when the 'short'
|
||||
option is set to True.
|
||||
|
||||
See also
|
||||
--------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue