diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-07-01 02:23:48 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-07-01 02:23:48 -0700 |
commit | 09562c823043991a9db93cccfa51d3bb9176e2dc (patch) | |
tree | 4180ca17794a882444264fa945a4e4e0158c6bd9 /tests | |
parent | a09ef568e5f714aa9bad201bd57859d73aa4188a (diff) |
Ensure ICC profile is inserted when transcoding
Diffstat (limited to 'tests')
-rw-r--r-- | tests/resources/tree-icc.pdf | bin | 0 -> 23079 bytes | |||
-rw-r--r-- | tests/resources/tree.png | bin | 0 -> 20944 bytes | |||
-rw-r--r-- | tests/test_image_access.py | 16 |
3 files changed, 9 insertions, 7 deletions
diff --git a/tests/resources/tree-icc.pdf b/tests/resources/tree-icc.pdf Binary files differnew file mode 100644 index 0000000..1b0d2ed --- /dev/null +++ b/tests/resources/tree-icc.pdf diff --git a/tests/resources/tree.png b/tests/resources/tree.png Binary files differnew file mode 100644 index 0000000..c1f4687 --- /dev/null +++ b/tests/resources/tree.png diff --git a/tests/test_image_access.py b/tests/test_image_access.py index b32a143..47ffccb 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -41,11 +41,6 @@ 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 @@ -311,8 +306,8 @@ def test_extract_direct_fails_nondefault_colortransform(congress): pim._extract_direct(stream=bio) -def test_icc(onebiticc): - xobj, _pdf = onebiticc +def test_icc_use(resources): + xobj, _pdf = first_image_in(resources / '1biticc.pdf') pim = PdfImage(xobj) assert pim.mode == '1' @@ -320,3 +315,10 @@ def test_icc(onebiticc): assert pim.bits_per_component == 1 assert pim.icc.profile.xcolor_space == 'GRAY' + + +def test_icc_extract(resources): + xobj, _pdf = first_image_in(resources / 'tree-icc.pdf') + + pim = PdfImage(xobj) + assert pim.as_pil_image().info['icc_profile'] == pim.icc.tobytes() |