ocrd_modelfactory package

Factory methods to create models for data, files, URLs.

ocrd_modelfactory.exif_from_filename(image_filename)[source]

Create OcrdExif by opening an image file with PIL and reading its metadata.

Parameters:

image_filename (str) – Local image path name (relative to workspace).

ocrd_modelfactory.page_from_file(input_file, **kwargs) OcrdPage[source]

Create OcrdPage from an OcrdFile or a file path representing either a PAGE-XML or an image (to generate a PAGE-XML for).

Parameters:

input_file (OcrdFile or str) – file to open and produce a PAGE DOM for

ocrd_modelfactory.page_from_image(input_file: OcrdFile | ClientSideOcrdFile, **kwargs) OcrdPage[source]

Create OcrdPage from an OcrdFile representing an image (i.e. should have @mimetype starting with image/).

Parameters:

input_file (OcrdFile) – file to open and produce a PAGE DOM for