Merge branch 'issue46' into devel
This commit is contained in:
commit
85c6f52add
2 changed files with 75 additions and 2 deletions
|
|
@ -176,7 +176,13 @@ class ColourSpecificationBox(Jp2kBox):
|
||||||
x = _colorspace_map_display[self.colorspace]
|
x = _colorspace_map_display[self.colorspace]
|
||||||
msg += '\n Colorspace: {0}'.format(x)
|
msg += '\n Colorspace: {0}'.format(x)
|
||||||
else:
|
else:
|
||||||
x = pprint.pformat(self.icc_profile)
|
# 2.7 has trouble pretty-printing ordered dicts so we just have
|
||||||
|
# to print as a regular dict in this case.
|
||||||
|
if sys.hexversion < 0x03000000:
|
||||||
|
icc_profile = dict(self.icc_profile)
|
||||||
|
else:
|
||||||
|
icc_profile = self.icc_profile
|
||||||
|
x = pprint.pformat(icc_profile)
|
||||||
lines = [' ' * 8 + y for y in x.split('\n')]
|
lines = [' ' * 8 + y for y in x.split('\n')]
|
||||||
msg += '\n ICC Profile:\n{0}'.format('\n'.join(lines))
|
msg += '\n ICC Profile:\n{0}'.format('\n'.join(lines))
|
||||||
|
|
||||||
|
|
@ -1695,7 +1701,10 @@ class UUIDBox(Jp2kBox):
|
||||||
uuid_data = _pretty_print_xml(self.data)
|
uuid_data = _pretty_print_xml(self.data)
|
||||||
elif self.uuid.bytes == b'JpgTiffExif->JP2':
|
elif self.uuid.bytes == b'JpgTiffExif->JP2':
|
||||||
uuid_type = ' (Exif)'
|
uuid_type = ' (Exif)'
|
||||||
uuid_data = '\n' + pprint.pformat(self.data)
|
# 2.7 has trouble pretty-printing ordered dicts, so print them
|
||||||
|
# as regular dicts. Not ideal, but at least it's good on 3.3+.
|
||||||
|
x = self.data if sys.hexversion >= 0x03000000 else dict(self.data)
|
||||||
|
uuid_data = '\n' + pprint.pformat(x)
|
||||||
else:
|
else:
|
||||||
uuid_type = ''
|
uuid_type = ''
|
||||||
uuid_data = '{0} bytes'.format(len(self.data))
|
uuid_data = '{0} bytes'.format(len(self.data))
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,70 @@ class TestPrinting(unittest.TestCase):
|
||||||
self.expected = expected
|
self.expected = expected
|
||||||
self.assertEqual(actual, expected)
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
|
@unittest.skipIf(data_root is None,
|
||||||
|
"OPJ_DATA_ROOT environment variable not set")
|
||||||
|
def test_icc_profile(self):
|
||||||
|
filename = os.path.join(data_root, 'input/nonregression/text_GBR.jp2')
|
||||||
|
j = glymur.Jp2k(filename)
|
||||||
|
print(j.box[3].box[1])
|
||||||
|
actual = sys.stdout.getvalue().strip()
|
||||||
|
lin27 = ["Colour Specification Box (colr) @ (179, 1339)",
|
||||||
|
" Method: any ICC profile",
|
||||||
|
" Precedence: 2",
|
||||||
|
" Approximation: accurately represents correct "
|
||||||
|
+ "colorspace definition",
|
||||||
|
" ICC Profile:",
|
||||||
|
" {'Color Space': 'RGB',",
|
||||||
|
" 'Connection Space': 'XYZ',",
|
||||||
|
" 'Creator': u'appl',",
|
||||||
|
" 'Datetime': "
|
||||||
|
+ "datetime.datetime(2009, 2, 25, 11, 26, 11),",
|
||||||
|
" 'Device Attributes': 'reflective, glossy, "
|
||||||
|
+ "positive media polarity, color media',",
|
||||||
|
" 'Device Class': 'display device profile',",
|
||||||
|
" 'Device Manufacturer': u'appl',",
|
||||||
|
" 'Device Model': '',",
|
||||||
|
" 'File Signature': u'acsp',",
|
||||||
|
" 'Flags': "
|
||||||
|
+ "'not embedded, can be used independently',",
|
||||||
|
" 'Illuminant': "
|
||||||
|
+ "array([ 0.96420288, 1. , 0.8249054 ]),",
|
||||||
|
" 'Platform': u'APPL',",
|
||||||
|
" 'Preferred CMM Type': 1634758764,",
|
||||||
|
" 'Rendering Intent': 'perceptual',",
|
||||||
|
" 'Size': 1328,",
|
||||||
|
" 'Version': '2.2.0'}"]
|
||||||
|
lin33 = ["Colour Specification Box (colr) @ (179, 1339)",
|
||||||
|
" Method: any ICC profile",
|
||||||
|
" Precedence: 2",
|
||||||
|
" Approximation: accurately represents correct "
|
||||||
|
+ "colorspace definition",
|
||||||
|
" ICC Profile:",
|
||||||
|
" {'Size': 1328,",
|
||||||
|
" 'Preferred CMM Type': 1634758764,",
|
||||||
|
" 'Version': '2.2.0',",
|
||||||
|
" 'Device Class': 'display device profile',",
|
||||||
|
" 'Color Space': 'RGB',",
|
||||||
|
" 'Connection Space': 'XYZ',",
|
||||||
|
" 'Datetime': "
|
||||||
|
+ "datetime.datetime(2009, 2, 25, 11, 26, 11),",
|
||||||
|
" 'File Signature': 'acsp',",
|
||||||
|
" 'Platform': 'APPL',",
|
||||||
|
" 'Flags': 'not embedded, can be used "
|
||||||
|
+ "independently',",
|
||||||
|
" 'Device Manufacturer': 'appl',",
|
||||||
|
" 'Device Model': '',",
|
||||||
|
" 'Device Attributes': 'reflective, glossy, "
|
||||||
|
+ "positive media polarity, color media',",
|
||||||
|
" 'Rendering Intent': 'perceptual',",
|
||||||
|
" 'Illuminant': "
|
||||||
|
+ "array([ 0.96420288, 1. , 0.8249054 ]),",
|
||||||
|
" 'Creator': 'appl'}"]
|
||||||
|
|
||||||
|
lines = lin27 if sys.hexversion < 0x03000000 else lin33
|
||||||
|
expected = '\n'.join(lines)
|
||||||
|
self.assertEqual(actual, expected)
|
||||||
|
|
||||||
@unittest.skipIf(data_root is None,
|
@unittest.skipIf(data_root is None,
|
||||||
"OPJ_DATA_ROOT environment variable not set")
|
"OPJ_DATA_ROOT environment variable not set")
|
||||||
def test_CRG(self):
|
def test_CRG(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue