diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-07-01 00:48:44 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-07-01 00:48:44 -0700 |
commit | a09ef568e5f714aa9bad201bd57859d73aa4188a (patch) | |
tree | cb1274b998137a67da79d42a9e6e6374de8e9b4a /tests | |
parent | 55e08534bd0572fc05740e767443b95a20e62b96 (diff) |
Add a PdfImage.icc property for accessing image ICC information
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resources/1biticc.pdf | bin | 0 -> 5661 bytes | |||
-rw-r--r-- | tests/test_image_access.py | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/resources/1biticc.pdf b/tests/resources/1biticc.pdf Binary files differnew file mode 100644 index 0000000..b33b4bb --- /dev/null +++ b/tests/resources/1biticc.pdf diff --git a/tests/test_image_access.py b/tests/test_image_access.py index d5b44b5..b32a143 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -41,6 +41,11 @@ def sandwich(resources): return first_image_in(resources / 'sandwich.pdf') +@pytest.fixture +def onebiticc(resources): + return first_image_in(resources / '1biticc.pdf') + + def test_image_from_nonimage(resources): pdf = Pdf.open(resources / 'congress.pdf') resources = pdf.pages[0].Contents @@ -304,3 +309,14 @@ def test_extract_direct_fails_nondefault_colortransform(congress): pim = PdfImage(xobj) with pytest.raises(UnsupportedImageTypeError): pim._extract_direct(stream=bio) + + +def test_icc(onebiticc): + xobj, _pdf = onebiticc + + pim = PdfImage(xobj) + assert pim.mode == '1' + assert pim.colorspace == '/ICCBased' + assert pim.bits_per_component == 1 + + assert pim.icc.profile.xcolor_space == 'GRAY' |