ocrd.processor.ocrd_page_result module

class ocrd.processor.ocrd_page_result.OcrdPageResultImage(pil: Image, file_id_suffix: str, alternative_image: AlternativeImageType | PageType | None)[source]

Bases: object

Encapsulates a single AlternativeImage reference to be persisted as image file to the ocrd.Workspace.

pil: Image

image data to be saved

file_id_suffix: str

a suffix to append to the file name when saving (something like .IMG according to OCR-D conventions for PAGE-XML)

alternative_image: AlternativeImageType | PageType | None

the AlternativeImage instance that references this image; to be amended with the actual (final) @filename when saving

alternatively, can be a Page instance: in that case, amend its @imageFilename (i.e. replace the original image of the PAGE-XML)

class ocrd.processor.ocrd_page_result.OcrdPageResultVariadicListWrapper(pcgts: OcrdPage, *args)[source]

Bases: object

Proxy object for ocrd.SingleOcrdPageResult allowing list semantics (i.e. multi-valued return from ocrd.Processor.process_page_pcgts()) without changing the API introduced in version 3.0.

Everything but list access will yield the old (singular valued) semantics.

pcgts: OcrdPage
images: List[OcrdPageResultImage]
ocrd.processor.ocrd_page_result.SingleOcrdPageResult

alias of OcrdPageResult

ocrd.processor.ocrd_page_result.OcrdPageResult[source]

alias of OcrdPageResultVariadicListWrapper