Skip to content

pypdf equivalent of PyMuPDF's pixmap? #2785

Closed Answered by stefan6419846
myedibleenso asked this question in Q&A
Discussion options

You must be logged in to vote

No, pypdf does not have the concept of pixmaps, as it has no actual rendering capabilities.

To render an image of a page or a page region, I tend to use pdftocairo directly. Image objects can be extracted as Pillow image objects - either through page.images or for any image content stream not covered by this method by calling content_stream.decode_as_image().

Speaking of your use case, you should be able to call image.replace() to get rid of the overlays if required (see https://pypdf.readthedocs.io/en/latest/modules/PageObject.html#pypdf._page.PageObject.images) and then render the page/page region with your tool of choice.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@myedibleenso
Comment options

Answer selected by myedibleenso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants