Skip to content

Commit 0c4bc76

Browse files
TEMP
1 parent 1f343c4 commit 0c4bc76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fmcore/algorithm/bedrock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def _compress_image_for_bedrock(image_bytes: bytes, max_size_mb: float = 4.5) ->
101101

102102
# Check if we're under the size limit
103103
if len(compressed_bytes) <= max_size_bytes:
104+
print(f'Final compressed image is {len(compressed_bytes) / (1024*1024):.2f}MB')
104105
return compressed_bytes
105106

106107
# If still too large, try reducing quality or scale
@@ -111,9 +112,8 @@ def _compress_image_for_bedrock(image_bytes: bytes, max_size_mb: float = 4.5) ->
111112
quality = 95 # Reset quality when scaling
112113
else:
113114
# If we can't compress enough, return what we have
114-
Log.warning(f"Unable to compress image below {max_size_mb}MB limit. "
115-
f"Final size: {len(compressed_bytes) / (1024*1024):.2f}MB")
116-
return compressed_bytes
115+
raise ValueError(f"Unable to compress image below {max_size_mb}MB limit. "
116+
f"Final size: {len(compressed_bytes) / (1024*1024):.2f}MB")
117117

118118
def process_image_url(image_url: str) -> Optional[str]:
119119
"""

0 commit comments

Comments
 (0)