Skip to content
Discussion options

You must be logged in to vote

We are pleased you like PyMuPDF!

You can determine images shown on a page in various ways. The most handy one probably is page.get_image_infos(xrefs=True). Returns a list of dictionaries. Each dict describes one image with a lot of meta information, among which there also is the bbox occupied on the page. So you can select the image contained / covered by your marker annot (which always has attribute rect).
If you use the xrefs option as indicated, then this is the xref of the image for extraction.
Note however, that - irritatingly perhaps - not all images have an xref! In this case, the number is zero.

You can still extract it - just not by xref number. Please come back for more advice …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by TunaFFish
Comment options

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

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