Skip to content
Discussion options

You must be logged in to vote

Sorry, there is no can do - for principal reasons, has nothing to do with MuPDF / PyMuPDF.
But I think I know what you are aiming at:

"When I know the position of some text on the page, then where on the image do I find hat text?"

  • The page rectangle, and the bboxes of everything on it, are Rect rectangles with float coordinates.
  • Every image, and everything on it, is addressable by pixels which has integer coordinates.
  • Rendering a page to an image therefore entails a transformation page.rect -> pix.irect.

To achieve what you want, you can use the matrix mat = page.rect.torect(pix.irect). Use this matrix to compute the position of some page bbox in the image by bbox * mat, or even more co…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ivanstepanovftw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants