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:
- https://nanonets.com/blog/ocr-with-tesseract/#ocr-with-pytesseract-and-opencv
- https://pypi.org/project/pytesseract/
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iiif2annos-0.0.5.tar.gz | 6.3 kB | Without provenance | Details for iiif2annos-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iiif2annos-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for iiif2annos-0.0.5-py3-none-any.whl |
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
|
Security for iiif2annos 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.