Skip to content

get_text("rawdict") always returns same values for image xres and yres #4433

Closed
@poffertje

Description

@poffertje

Description of the bug

I am using this code to find information about the DPI of the images contained on the page, but no matter which PDF or what Image i check, the function always returns the same xres == yres = 96, which I suppose is the default of the library.

How to reproduce the bug

with fitz.open(pdf_path) as doc:
    page = doc[0]
    blocks =  page.get_text("rawdict", sort=True, clip=page.trimbox)["blocks"]
    images = [block for block in blocks if block["type"] == 1]
    
    for i, image in enumerate(images):
        log.debug(f"xres: {image['xres']}, yres: {image['yres']}"}

Output:

08-04-2025 16:35:04 - t_processor - DEBUG - Xres: 96, Yres: 96
08-04-2025 16:35:04 - t_processor - DEBUG - Xres: 96, Yres: 96
08-04-2025 16:35:04 - t_processor - DEBUG - Xres: 96, Yres: 96
08-04-2025 16:35:04 - t_processor - DEBUG - Xres: 96, Yres: 96

Does this run as intended?
Is there a different way to do what I want with the library?

Thank you for the great work!

PyMuPDF version

1.25.4

Operating system

Windows

Python version

3.10

Metadata

Metadata

Assignees

Labels

not a bugnot a bug / user error / unable to reproducewontfixno intention to resolve

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions