Server-side EXIF GPS extraction on upload/photo and OCR endpoints #25

Closed
opened 2026-05-21 21:18:11 +00:00 by shawn · 0 comments
Owner

Changes

Added PIL-based EXIF GPS extraction to server.py:

  • _extract_gps_from_bytes() helper reads GPSInfo IFD via PIL get_ifd()
  • Converts DMS (degrees/minutes/seconds) to decimal degrees
  • /api/upload/photo: reads raw bytes first, extracts GPS before saving, returns {path, exif_gps}
  • /api/ocr: extracts GPS from raw bytes before OCR processing, returns {machine_id, exif_gps, ...}
  • Photos without EXIF GPS omit the exif_gps key entirely
  • _save_upload_bytes() helper added for pre-read byte buffers
  • Raw file bytes preserved (no re-compression, no EXIF stripping)

Commit: 7cf566a

## Changes Added PIL-based EXIF GPS extraction to server.py: - `_extract_gps_from_bytes()` helper reads GPSInfo IFD via PIL `get_ifd()` - Converts DMS (degrees/minutes/seconds) to decimal degrees - `/api/upload/photo`: reads raw bytes first, extracts GPS before saving, returns `{path, exif_gps}` - `/api/ocr`: extracts GPS from raw bytes before OCR processing, returns `{machine_id, exif_gps, ...}` - Photos without EXIF GPS omit the `exif_gps` key entirely - `_save_upload_bytes()` helper added for pre-read byte buffers - Raw file bytes preserved (no re-compression, no EXIF stripping) Commit: 7cf566a
shawn closed this issue 2026-05-21 21:18:19 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/canteen-asset-tracker#25