MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_pdfpixmap

Function test_pdfpixmap

tests/test_pixmap.py:39–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39def test_pdfpixmap():
40 # pixmap from xref in a PDF
41 doc = pymupdf.open(pdf)
42 # take first image item of first page
43 img = doc.get_page_images(0)[0]
44 # make pixmap of it
45 pix = pymupdf.Pixmap(doc, img[0])
46 # assert pixmap properties
47 assert pix.width == img[2]
48 assert pix.height == img[3]
49 # extract image and compare metadata
50 extractimg = doc.extract_image(img[0])
51 assert extractimg["width"] == pix.width
52 assert extractimg["height"] == pix.height
53
54
55def test_filepixmap():

Callers

nothing calls this directly

Calls 2

get_page_imagesMethod · 0.80
extract_imageMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…