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:
|
||||
# Process image (crop + rotation + compression + thumbnail)
|
||||
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)
|
||||
log.info(f"[AUTO_SAVE] Processing result: status={process_result.get('status')}")
|
||||
|
||||
if process_result.get('status') != 'success':
|
||||
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)
|
||||
image = Image.open(io.BytesIO(file_bytes))
|
||||
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)
|
||||
exif_orientation = self._extract_exif_orientation(image)
|
||||
@@ -100,11 +102,15 @@ class ImageProcessor:
|
||||
crop_bounds['x'] + crop_bounds['width'],
|
||||
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)
|
||||
crop_size = cropped_image.size
|
||||
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:
|
||||
# Try OpenCV smart crop on raw image
|
||||
self.logger.info("[CROP] Attempting OpenCV smart crop...")
|
||||
|
||||
Reference in New Issue
Block a user