Skip to content

Commit

Permalink
fix: issues about local image path (#1750)
Browse files Browse the repository at this point in the history
Co-authored-by: Wendong-Fan <[email protected]>
  • Loading branch information
raywhoelse and Wendong-Fan authored Mar 9, 2025
1 parent 43e7f0d commit 8a2af9d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions camel/toolkits/image_analysis_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ def _load_image(self, image_path: str) -> Image.Image:
else:
logger.debug(f"Loading local image: {image_path}")
try:
with Image.open(image_path) as img:
# Load immediately to detect errors
img.load()
return img.copy()
return Image.open(image_path)
except Exception as e:
logger.error(f"Image loading failed: {e}")
raise ValueError(f"Invalid image file: {e}")
Expand Down

0 comments on commit 8a2af9d

Please sign in to comment.