debug: add explicit logging to show crop bounds and rotation values

This commit is contained in:
2026-04-22 09:55:53 +03:00
parent 197dcadfee
commit 92c8517663
2 changed files with 11 additions and 3 deletions

View File

@@ -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...")