diff options
author | James R. Barlow <jim@purplerock.ca> | 2018-05-24 15:59:47 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2018-05-24 15:59:47 -0700 |
commit | 5acb9dcf13ab04dce7a1c2e76de3658d5fe49fcc (patch) | |
tree | da2b50c454e28f67c03cd02b91096264969290e2 /tests/test_image_access.py | |
parent | a7dd5030463e9d4ed592361ac8eac7cef8a325f3 (diff) |
Add support for accessing inline images
Diffstat (limited to 'tests/test_image_access.py')
-rw-r--r-- | tests/test_image_access.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/test_image_access.py b/tests/test_image_access.py index 56ca82c..9124414 100644 --- a/tests/test_image_access.py +++ b/tests/test_image_access.py @@ -5,7 +5,8 @@ from PIL import Image import zlib import sys -from pikepdf import Pdf, Object, PdfImage, PdfError, Name, Null +from pikepdf import (Pdf, Object, PdfImage, PdfError, Name, Null, + parse_content_stream, ObjectType, PdfInlineImage) @pytest.fixture @@ -74,3 +75,18 @@ def test_lowlevel_replace_jpeg(congress, outdir): pdf = congress[1] pdf.save(outdir / 'congress_gray.pdf') + + +@pytest.fixture +def inline(resources): + pdf = Pdf.open(resources / 'image-mono-inline.pdf') + for operands, command in parse_content_stream(pdf.pages[0]): + if operands and isinstance(operands[0], PdfInlineImage): + return operands[0], pdf + + +def test_inline(inline): + iimage, pdf = inline + assert iimage.width == 8 + assert iimage.image_mask == False + assert iimage.mode == 'RGB' |