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.
|
Entry point for console script jp2dump.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
description = 'Print JPEG2000 metadata.'
|
kwargs = {'description': 'Print JPEG2000 metadata.',
|
||||||
parser = argparse.ArgumentParser(description=description)
|
'formatter_class': argparse.ArgumentDefaultsHelpFormatter}
|
||||||
|
parser = argparse.ArgumentParser(**kwargs)
|
||||||
|
|
||||||
parser.add_argument('-x', '--noxml',
|
parser.add_argument('-x', '--noxml',
|
||||||
help='Suppress XML.',
|
help='suppress XML',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('-s', '--short',
|
parser.add_argument('-s', '--short',
|
||||||
help='Only print box id, offset, and length.',
|
help='only print box id, offset, and length',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
|
|
||||||
chelp = 'Level of codestream information. 0 suppressed all details, '
|
chelp = 'Level of codestream information. 0 suppresses all details, '
|
||||||
chelp += '1 prints headers, 2 prints the full codestream'
|
chelp += '1 prints the main header, 2 prints the full codestream.'
|
||||||
parser.add_argument('-c', '--codestream',
|
parser.add_argument('-c', '--codestream',
|
||||||
help=chelp,
|
help=chelp,
|
||||||
|
metavar='LEVEL',
|
||||||
nargs=1,
|
nargs=1,
|
||||||
type=int,
|
type=int,
|
||||||
default=[0])
|
default=[1])
|
||||||
|
|
||||||
parser.add_argument('filename')
|
parser.add_argument('filename')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1040,10 +1040,11 @@ class ContiguousCodestreamBox(Jp2kBox):
|
||||||
msg = Jp2kBox.__str__(self)
|
msg = Jp2kBox.__str__(self)
|
||||||
if _printoptions['short'] is True:
|
if _printoptions['short'] is True:
|
||||||
return msg
|
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
|
return msg
|
||||||
|
|
||||||
msg += '\n Main header:'
|
|
||||||
for segment in self.main_header.segment:
|
for segment in self.main_header.segment:
|
||||||
msg += '\n' + self._indent(str(segment), indent_level=8)
|
msg += '\n' + self._indent(str(segment), indent_level=8)
|
||||||
|
|
||||||
|
|
@ -3360,7 +3361,7 @@ def get_parseoptions():
|
||||||
"""
|
"""
|
||||||
return _parseoptions
|
return _parseoptions
|
||||||
|
|
||||||
_printoptions = {'short': False, 'xml': True, 'codestream': True}
|
_printoptions = {'short': False, 'xml': True, 'siz': True}
|
||||||
|
|
||||||
|
|
||||||
def set_printoptions(**kwargs):
|
def set_printoptions(**kwargs):
|
||||||
|
|
@ -3377,8 +3378,10 @@ def set_printoptions(**kwargs):
|
||||||
xml : bool, optional
|
xml : bool, optional
|
||||||
When False, printing of the XML contents of any XML boxes or UUID XMP
|
When False, printing of the XML contents of any XML boxes or UUID XMP
|
||||||
boxes is suppressed.
|
boxes is suppressed.
|
||||||
codestream : bool, optional
|
siz : bool, optional
|
||||||
When False, printing of the codestream contents is suppressed.
|
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
|
See also
|
||||||
--------
|
--------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue