Simple verbose shell pipeline to OCR images sequentially by image time.
- Finds images in
input_images(heic,webp,png,jpg,jpeg) - Sorts by time priority:
DateTimeOriginal->CreateDate->FileModifyDate - Converts each image to
jpgat1280x720(720p) - Sends each image to local Ollama model (default:
glm-ocr:latest) - Saves per-image OCR text and combined OCR text
ocr_to_txt.sh: main OCR scriptcreate_synthetic_test_data.sh: creates 2 synthetic test images
ollamarunning locally athttp://127.0.0.1:11434- commands:
curl,jq,exiftool,base64,convert(ImageMagick) ormagick
./create_synthetic_test_data.sh ./input_images
./ocr_to_txt.sh ./input_images ./work_jpg_720 ./ocr_output glm-ocr:latest- Per image text:
./ocr_output/txt/*.txt - Combined text:
./ocr_output/all_ocr.txt
OLLAMA_URL(defaulthttp://127.0.0.1:11434)OCR_TIMEOUT(default45; use0for no timeout)OCR_NUM_PREDICT(default128)OCR_NUM_CTX(default2048)CONVERT_TIMEOUT(default120)OCR_PROMPT(custom OCR prompt)