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.
This commit is contained in:
@@ -148,10 +148,12 @@ class ImageProcessor:
|
|||||||
cropped_image = self._rotate_by_orientation(cropped_image, exif_orientation)
|
cropped_image = self._rotate_by_orientation(cropped_image, exif_orientation)
|
||||||
self.logger.info(f"Applied EXIF rotation: {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:
|
if abs(rotation_degrees) > 0.5:
|
||||||
cropped_image = cropped_image.rotate(-rotation_degrees, expand=True)
|
cropped_image = cropped_image.rotate(rotation_degrees, expand=True)
|
||||||
self.logger.info(f"Applied manual rotation: {rotation_degrees}°")
|
msg = f"Applied manual rotation: {rotation_degrees}°"
|
||||||
|
self.logger.info(msg)
|
||||||
|
print(f">>> {msg}") # Explicit print
|
||||||
|
|
||||||
# Resize and compress
|
# Resize and compress
|
||||||
compressed_bytes = self._resize_and_compress(cropped_image)
|
compressed_bytes = self._resize_and_compress(cropped_image)
|
||||||
|
|||||||
Reference in New Issue
Block a user