Replies: 3 comments 1 reply
-
You seem to be looking for the boundary box of the image on the page. This can be found out via get_image_rects. This method can also tell you the transformation matrix used to make the image fit into its bbox. |
Beta Was this translation helpful? Give feedback.
-
This is not what I wanted, and the result is the same as the bounding box I got using page.get_text. What I need is the 'width', 'height' argument in page.get_text, but the 'width', 'height' argument in page.get_text is not the actual size after scaling, but before scaling. |
Beta Was this translation helpful? Give feedback.
-
The bounding box value for bbox is always based on the PDF page size. Let's say our PDF page is A4 (595*842), the user has placed an image in this page that is actually 2480 x 3507,300 DPI in width and height, and scaled the image so that it appears smaller than the entire PDF page (I don't know the user scaling factor), At this point I want to know the width and height of the image itself after scaling, and the bbox result is based on the width and height of the PDF page. In some software, such as PDF-XChange_Edito, it can accurately calculate the pixel width and height of a zoomed-out image when saving the image. |
Beta Was this translation helpful? Give feedback.
-
How to calculate the actual size of some images that have been irregularly scaled?The result of page.get_text has only 'width', 'height' before scaling. The 'bbox' can be used to calculate the aspect ratio after scaling, but these parameters do not seem to calculate the actual 'width', 'height' after scaling.
Beta Was this translation helpful? Give feedback.
All reactions