diff options
author | James R. Barlow <jim@purplerock.ca> | 2018-09-19 00:09:12 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2018-09-19 00:09:12 -0700 |
commit | 739ff43491b032dd16ba9e50574ddf2e2af053dc (patch) | |
tree | 2731d9e839d0c0698c3ab3287f428e4c3219be9d /tests | |
parent | 16b96e0b05c7f236f1f4cba52ed16713d3c4b52c (diff) |
Add test case for JPEG2000
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resources/pike-jp2.pdf | bin | 0 -> 18152 bytes | |||
-rw-r--r-- | tests/test_image_access.py | 15 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/resources/pike-jp2.pdf b/tests/resources/pike-jp2.pdf Binary files differnew file mode 100644 index 0000000..588fcd6 --- /dev/null +++ b/tests/resources/pike-jp2.pdf diff --git a/tests/test_image_access.py b/tests/test_image_access.py index d321e8f..68ab407 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -231,3 +231,18 @@ def test_image_palette(resources, filename, bpc): def test_bool_in_inline_image(): piim = PdfInlineImage(image_data=b'', image_object=(Name.IM, True)) assert piim.image_mask + + +def test_jp2(resources): + pdf = Pdf.open(resources / 'pike-jp2.pdf') + pim = PdfImage(next(iter(pdf.pages[0].images.values()))) + + assert '/JPXDecode' in pim.filters + assert pim.colorspace == '/DeviceRGB' + assert not pim.is_inline + assert not pim.indexed + assert pim.mode == 'RGB' + assert pim.bits_per_component == 8 + + outstream = BytesIO() + pim.extract_to(stream=outstream) |