Skip to main content

iiif2annos

Read a manifest, OCR the images, create AnnotationLists and add them to a copy of the manifest

This tool uses the tesseract OCR engine. Ensure you have this installed and on your $PATH before running the code below.

usage: ocr.py [-h] [--base-output-uri OUTPUTURI] [--lang LANG] [-c] manifest output

Read a manifest, OCR all the pages then adds the results as annotation lists

positional arguments:
  manifest              URL to Manifest file
  output                Output directory for annotation lists

options:
  -h, --help            show this help message and exit
  --base-output-uri OUTPUTURI
                        Output URI for annotations and annotation list
  --lang LANG           Language to pass to the OCR engine see: https://tesseract-ocr.github.io/tessdoc/Data-Files-in-different-versions.html
  -c, --confidence      Include OCR confidence value in text of the annotation?

This should work with v2 manifests and v3 manifest. For v2 AnnotationLists are created for v3 AnnotationPages are created.

Example

python iiif2annos/ocr.py --lang frk --base-output-uri http://localhost:5500/newspaper https://preview.iiif.io/cookbook/update_newspaper/recipe/0068-newspaper/newspaper_issue_1-manifest.json  newspaper

Using these blogs as a guide:

Testing

Unit tests are in the tests folder and can be run with:

python -m unittest discover -s tests

Run single test:

python -m unittest tests.testImages.TestImage.testCanvasImageMissmatch

Metadata

Release files for iiif2annos 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iiif2annos 0.0.5
File Size Uploaded
iiif2annos-0.0.5.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iiif2annos 0.0.5
File Interpreter ABI Platform
iiif2annos-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / iiif2annos-0.0.5.tar.gz

Download URL iiif2annos-0.0.5.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e59e58ac331fee808efdb5165df6479b3f350ed8b5fd709ea41e5d6b508d168e
BLAKE2b-256 checksum
How to use checksums
3871cb327eca1b43f6ba94ba04180b4dd8b9e82508357e8be7b95d0ebf83c874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / iiif2annos-0.0.5-py3-none-any.whl

Download URL iiif2annos-0.0.5-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c7d3bcf98aed90aed70aeea2a5299eef267d91b60b1f982a1cf6f7750c60c23
BLAKE2b-256 checksum
How to use checksums
dce58a6307ab485639732c6ff5dc910f5dc7ae32c77dda8f7359ea3bca3d7774
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page