Skip to content

Request: expose DPI to image scale constant of 72 #2405

@jamesbraza

Description

@jamesbraza

Requested feature

It seems sprinkled across the Docling codebase is a magic number 72. For example, https://github.com/docling-project/docling/blob/v2.55.1/docling/pipeline/standard_pdf_pipeline.py#L200-L202.

https://docling-project.github.io/docling/examples/export_multimodal/ mentions:

IMAGE_RESOLUTION_SCALE: page rendering scale (1 ~ 72 DPI).

In my own code, I work with DPI. So I need to convert DPI to image_scale for PdfPipelineOptions. Can Docling expose this as an importable constant?

IMAGES_SCALE_PER_DPI: int = 72

dpi = 144
print(dpi / IMAGES_SCALE_PER_DPI)  # 2

Alternatives

Redefining the conversion constant 72 in my own code, which is the workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions