-
Hello, amazing PDF library, thanks so much 👍 For studying I am looking for a way to make a summary of my annotations. Apart from PDF_ANNOT_HIGHLIGHT I tried PDF_ANNOT_UNDERLINE and PDF_ANNOT_TEXT for Sticky Notes with What's next on my list is to extract certain images - by annotation. Can you give me a tip on how to do this? Any help appreciated, cheers!
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We are pleased you like PyMuPDF! You can determine images shown on a page in various ways. The most handy one probably is
Another potential hickup, or rather thing to watch out for: |
Beta Was this translation helpful? Give feedback.
-
Thanks so much for the help, much appreciated!
Thanks again! 🙏😎 |
Beta Was this translation helpful? Give feedback.
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 attributerect
).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.