debug: add explicit logging to show crop bounds and rotation values
This commit is contained in:
@@ -586,7 +586,9 @@ def _auto_save_photo_from_extraction(
|
|||||||
try:
|
try:
|
||||||
# Process image (crop + rotation + compression + thumbnail)
|
# Process image (crop + rotation + compression + thumbnail)
|
||||||
processor = ImageProcessor()
|
processor = ImageProcessor()
|
||||||
|
log.info(f"[AUTO_SAVE] Processing photo: crop_bounds={crop_bounds_validated}, rotation_degrees={rotation_degrees or 0}")
|
||||||
process_result = processor.process_photo(image_bytes, crop_bounds_validated, rotation_degrees=rotation_degrees or 0)
|
process_result = processor.process_photo(image_bytes, crop_bounds_validated, rotation_degrees=rotation_degrees or 0)
|
||||||
|
log.info(f"[AUTO_SAVE] Processing result: status={process_result.get('status')}")
|
||||||
|
|
||||||
if process_result.get('status') != 'success':
|
if process_result.get('status') != 'success':
|
||||||
error_msg = process_result.get('error', 'Unknown error')
|
error_msg = process_result.get('error', 'Unknown error')
|
||||||
|
|||||||
@@ -81,7 +81,9 @@ class ImageProcessor:
|
|||||||
# Open image with PIL (without applying EXIF yet, so crop_bounds match AI analysis)
|
# Open image with PIL (without applying EXIF yet, so crop_bounds match AI analysis)
|
||||||
image = Image.open(io.BytesIO(file_bytes))
|
image = Image.open(io.BytesIO(file_bytes))
|
||||||
original_size = image.size
|
original_size = image.size
|
||||||
self.logger.info(f"[PROCESS] Input: {len(file_bytes)} bytes, size={original_size}, crop_bounds={crop_bounds}, rotation={rotation_degrees}°")
|
msg = f"[PROCESS] Input: {len(file_bytes)} bytes, size={original_size}, crop_bounds={crop_bounds}, rotation={rotation_degrees}°"
|
||||||
|
self.logger.info(msg)
|
||||||
|
print(f">>> {msg}") # Explicit print for visibility
|
||||||
|
|
||||||
# Extract EXIF orientation (but don't apply yet)
|
# Extract EXIF orientation (but don't apply yet)
|
||||||
exif_orientation = self._extract_exif_orientation(image)
|
exif_orientation = self._extract_exif_orientation(image)
|
||||||
@@ -100,11 +102,15 @@ class ImageProcessor:
|
|||||||
crop_bounds['x'] + crop_bounds['width'],
|
crop_bounds['x'] + crop_bounds['width'],
|
||||||
crop_bounds['y'] + crop_bounds['height'],
|
crop_bounds['y'] + crop_bounds['height'],
|
||||||
)
|
)
|
||||||
self.logger.info(f"[CROP] Manual bounds: {crop_rect}")
|
msg1 = f"[CROP] Manual bounds: {crop_rect}"
|
||||||
|
self.logger.info(msg1)
|
||||||
|
print(f">>> {msg1}") # Explicit print
|
||||||
cropped_image = image.crop(crop_rect)
|
cropped_image = image.crop(crop_rect)
|
||||||
crop_size = cropped_image.size
|
crop_size = cropped_image.size
|
||||||
crop_method = 'manual'
|
crop_method = 'manual'
|
||||||
self.logger.info(f"[CROP] Result size: {crop_size}, pixels={crop_size[0]*crop_size[1]}")
|
msg2 = f"[CROP] Result size: {crop_size}, pixels={crop_size[0]*crop_size[1]}"
|
||||||
|
self.logger.info(msg2)
|
||||||
|
print(f">>> {msg2}") # Explicit print
|
||||||
else:
|
else:
|
||||||
# Try OpenCV smart crop on raw image
|
# Try OpenCV smart crop on raw image
|
||||||
self.logger.info("[CROP] Attempting OpenCV smart crop...")
|
self.logger.info("[CROP] Attempting OpenCV smart crop...")
|
||||||
|
|||||||
Reference in New Issue
Block a user