Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix: issues about local image path (#1750)

Ray8a2af9d02b87
diff --git a/camel/toolkits/image_analysis_toolkit.py b/camel/toolkits/image_analysis_toolkit.py
index 5a438cd01..07efa7ae5 100644
--- a/camel/toolkits/image_analysis_toolkit.py
+++ b/camel/toolkits/image_analysis_toolkit.py
@@ -138,10 +138,7 @@ class ImageAnalysisToolkit(BaseToolkit):
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}")