OCR: sniff image magic bytes; route mislabeled formats via LibreOffice

↗ view on GitHub · emileriksenkeev · 2026-07-16 · 71413433

The HR backfill surfaced an iPhone HEIC stored as ".JPEG": we sent its
raw bytes as image/jpeg and the API replied 400 "Could not process
image". Trust the magic bytes over the extension, and when the bytes
aren't real JPEG/PNG, force the LibreOffice->PDF->pdftoppm shrink path,
which re-encodes to PNG the API accepts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository emileriksenkeev/sydOS
Author emileriksenkeev <emil@keev.co>
Authored
Parents d1d7cd55
Stats 1 file changed , +33 , -6
Part of Text extraction and OCR hardening

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-71413433.md from inside the repo you want the change in.

⬇ Download capture-commit-71413433.md