fix: strip EXIF from image blob in backend before processing

Backend receives the original blob which may have EXIF orientation metadata.
Strip it before processing to ensure backend analyzes the same raw image space
that Gemini analyzed (which had EXIF stripped before sending).

This ensures rotation_degrees are applied correctly to the same image state.
This commit is contained in:
2026-04-22 10:32:38 +03:00
parent bc2a6219fe
commit 500d090dfc

View File

@@ -161,6 +161,10 @@ def create_item(
image_bytes = base64.b64decode(item.extracted_image_bytes)
log.info(f"[CREATE_ITEM] Received {len(image_bytes)} bytes for photo processing (base64 decoded)")
# Strip EXIF orientation to match what Gemini analyzed
image_bytes = strip_exif_orientation(image_bytes)
log.info(f"[CREATE_ITEM] After EXIF strip: {len(image_bytes)} bytes")
photo_result = _auto_save_photo_from_extraction(
item_id=db_item.id,
image_bytes=image_bytes,