added check to only crop pfp if > minimum Discord pfp resolution
This commit is contained in:
@@ -486,8 +486,15 @@ class ProfilePictureManager:
|
||||
if debug:
|
||||
logger.warning("Description generation returned None")
|
||||
|
||||
# Step 3: Detect face and crop intelligently
|
||||
cropped_image = await self._intelligent_crop(image, image_bytes, target_size=512, debug=debug)
|
||||
# Step 3: Detect face and crop intelligently (skip if already at/below Discord avatar size)
|
||||
target_size = 512
|
||||
width, height = image.size
|
||||
if width <= target_size and height <= target_size:
|
||||
if debug:
|
||||
logger.info(f"Image already at/below target size ({width}x{height} <= {target_size}x{target_size}), skipping crop")
|
||||
cropped_image = image
|
||||
else:
|
||||
cropped_image = await self._intelligent_crop(image, image_bytes, target_size=target_size, debug=debug)
|
||||
|
||||
if not cropped_image:
|
||||
result["error"] = "Failed to crop image"
|
||||
|
||||
Reference in New Issue
Block a user