Skip to content

Commit

Permalink
tests/test_pixmap.py: added test_2369() for #2369.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Apr 25, 2023
1 parent 1394092 commit e6da78c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_pixmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,19 @@ def test_samples_ptr():
samples = pm.samples_ptr
print( f'samples={samples}')
assert isinstance( samples, int)

def test_2369():

width, height = 13, 37
image = fitz.Pixmap(fitz.csGRAY, width, height, b"\x00" * (width * height), False)

with fitz.Document(stream=image.tobytes(output="pam"), filetype="pam") as doc:
test_pdf_bytes = doc.convert_to_pdf()

with fitz.Document(stream=test_pdf_bytes) as doc:
page = doc[0]
img_xref = page.get_images()[0][0]
img = doc.extract_image(img_xref)
img_bytes = img["image"]
fitz.Pixmap(img_bytes)

0 comments on commit e6da78c

Please sign in to comment.