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, with_tree=False) PcGtsType | Tuple[PcGtsType, Element, dict, dict] [source]¶
Create
OcrdPage
from anOcrdFile
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- Keyword Arguments:
with_tree (boolean) – whether to return XML node tree, element-node mapping and reverse mapping, too (cf.
ocrd_models.ocrd_page.parseEtree()
)
- ocrd_modelfactory.page_from_image(input_file, with_tree=False)[source]¶
Create
OcrdPage
from anOcrdFile
representing an image (i.e. should have@mimetype
starting withimage/
).- Parameters:
input_file (
OcrdFile
) – file to open and produce a PAGE DOM for- Keyword Arguments:
with_tree (boolean) – whether to return XML node tree, element-node mapping and reverse mapping, too (cf.
ocrd_models.ocrd_page.parseEtree()
)