From 4e23899f87a1c221b20bea8e252b1ed338d85903 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Wed, 22 Apr 2026 10:06:29 +0300 Subject: [PATCH] fix: remove negation from rotation to match prompt semantics New prompt defines rotation_degrees as already signed: - positive = counter-clockwise rotation - negative = clockwise rotation Old code negated it: rotate(-rotation_degrees), which inverted the direction. Now: rotate(rotation_degrees) directly uses Gemini's signed value. --- backend/services/image_processing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/services/image_processing.py b/backend/services/image_processing.py index c47fa5b8..d871c0ef 100644 --- a/backend/services/image_processing.py +++ b/backend/services/image_processing.py @@ -148,10 +148,12 @@ class ImageProcessor: cropped_image = self._rotate_by_orientation(cropped_image, exif_orientation) self.logger.info(f"Applied EXIF rotation: {exif_orientation}") - # Apply manual rotation if provided + # Apply manual rotation if provided (rotation_degrees already signed: positive=CCW, negative=CW) if abs(rotation_degrees) > 0.5: - cropped_image = cropped_image.rotate(-rotation_degrees, expand=True) - self.logger.info(f"Applied manual rotation: {rotation_degrees}°") + cropped_image = cropped_image.rotate(rotation_degrees, expand=True) + msg = f"Applied manual rotation: {rotation_degrees}°" + self.logger.info(msg) + print(f">>> {msg}") # Explicit print # Resize and compress compressed_bytes = self._resize_and_compress(cropped_image)