Repository navigation
feat: add batch processing for image directories - #4
Merged
estherg12 merged 2 commits intoSep 14, 2026
Merged
Conversation
estherg12
approved these changes
Sep 14, 2026
estherg12
left a comment
Owner
There was a problem hiding this comment.
Thank you very much for your interest and collaboration!!
Everthing seems fine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2.
This PR adds directory-level batch processing for handwriting OCR transcription:
batch_process.py):get_image_files(directory): Discovers and sorts all supported image formats (.jpg,.jpeg,.png, case-insensitive).process_image(image_path, ...): Chains line detection withmeasure_text_lines(), crops and saves text lines withcrop_and_save_lines(), transcribes lines, cleans up temporary crop files, and exports transcriptions to.txtand.pdffiles named directly after the source image stem (output/<image_stem>.txtandoutput/<image_stem>.pdf) as well as raw/NLP variants.batch_process(directory, ...): Processes an entire folder of handwriting images.cleanup_line_crops()preserving final output artifacts.export_to_pdf(): Robust Unicode punctuation sanitization (em-dashes, en-dashes, typographical quotes, bullets, ellipses) preventingFPDFUnicodeEncodingExceptionunder Latin-1 fonts.main.py):argparsetomain.pysupporting positional directory/image path,--folder DIR/-f,--image FILE/-i,--output DIR/-o, and--model-dir PATH/-m.tests/test_batch_process.py):README.mdsetup & usage instructions with single image and batch directory processing commands.Verification
uv run pytest: All 13 tests pass cleanly (test_batch_process.pyandtest_count_lines.py).uv run flake8: 0 errors/warnings on new code.