diff --git a/en/.doctrees/agentscope.manager.doctree b/en/.doctrees/agentscope.manager.doctree index 172295380..411271649 100644 Binary files a/en/.doctrees/agentscope.manager.doctree and b/en/.doctrees/agentscope.manager.doctree differ diff --git a/en/.doctrees/environment.pickle b/en/.doctrees/environment.pickle index 056f8e996..b906d39d6 100644 Binary files a/en/.doctrees/environment.pickle and b/en/.doctrees/environment.pickle differ diff --git a/en/.doctrees/index.doctree b/en/.doctrees/index.doctree index 45724011b..81f3bbe8d 100644 Binary files a/en/.doctrees/index.doctree and b/en/.doctrees/index.doctree differ diff --git a/en/_modules/agentscope/manager/_file.html b/en/_modules/agentscope/manager/_file.html index eaf357666..e174eed2c 100644 --- a/en/_modules/agentscope/manager/_file.html +++ b/en/_modules/agentscope/manager/_file.html @@ -328,7 +328,7 @@
[docs]
def save_image(
self,
- image: Union[str, np.ndarray, bytes],
+ image: Union[str, np.ndarray, bytes, Image.Image],
filename: Optional[str] = None,
) -> str:
"""Save image file locally, and return the local image path.
@@ -360,10 +360,13 @@ Source code for agentscope.manager._file
elif isinstance(image, bytes):
# save image via bytes
Image.open(io.BytesIO(image)).save(path_file)
+ elif isinstance(image, Image.Image):
+ # save image via PIL.Image.Image
+ image.save(path_file)
else:
raise ValueError(
- f"Unsupported image type: {type(image)}"
- "Must be str, np.ndarray, or bytes.",
+ f"Unsupported image type: {type(image)} Must be str, "
+ f"np.ndarray, bytes, or PIL.Image.Image.",
)
return path_file
diff --git a/en/agentscope.manager.html b/en/agentscope.manager.html
index 5af3a2929..954adbc20 100644
--- a/en/agentscope.manager.html
+++ b/en/agentscope.manager.html
@@ -199,7 +199,7 @@ agentscope.manager package
-save_image(image: str | ndarray | bytes, filename: str | None = None) str [source]
+save_image(image: str | ndarray | bytes | Image, filename: str | None = None) str [source]
Save image file locally, and return the local image path.
- Parameters:
diff --git a/zh_CN/.doctrees/agentscope.manager.doctree b/zh_CN/.doctrees/agentscope.manager.doctree
index 5d4ccab2b..3d04c71fc 100644
Binary files a/zh_CN/.doctrees/agentscope.manager.doctree and b/zh_CN/.doctrees/agentscope.manager.doctree differ
diff --git a/zh_CN/.doctrees/environment.pickle b/zh_CN/.doctrees/environment.pickle
index bc917fc10..64aa6c86a 100644
Binary files a/zh_CN/.doctrees/environment.pickle and b/zh_CN/.doctrees/environment.pickle differ
diff --git a/zh_CN/.doctrees/index.doctree b/zh_CN/.doctrees/index.doctree
index 3e3ab17e7..fb5e2602c 100644
Binary files a/zh_CN/.doctrees/index.doctree and b/zh_CN/.doctrees/index.doctree differ
diff --git a/zh_CN/_modules/agentscope/manager/_file.html b/zh_CN/_modules/agentscope/manager/_file.html
index e9a10ef2a..29cf904aa 100644
--- a/zh_CN/_modules/agentscope/manager/_file.html
+++ b/zh_CN/_modules/agentscope/manager/_file.html
@@ -329,7 +329,7 @@ agentscope.manager._file 源代码
[文档]
def save_image(
self,
- image: Union[str, np.ndarray, bytes],
+ image: Union[str, np.ndarray, bytes, Image.Image],
filename: Optional[str] = None,
) -> str:
"""Save image file locally, and return the local image path.
@@ -361,10 +361,13 @@ agentscope.manager._file 源代码
elif isinstance(image, bytes):
# save image via bytes
Image.open(io.BytesIO(image)).save(path_file)
+ elif isinstance(image, Image.Image):
+ # save image via PIL.Image.Image
+ image.save(path_file)
else:
raise ValueError(
- f"Unsupported image type: {type(image)}"
- "Must be str, np.ndarray, or bytes.",
+ f"Unsupported image type: {type(image)} Must be str, "
+ f"np.ndarray, bytes, or PIL.Image.Image.",
)
return path_file
diff --git a/zh_CN/agentscope.manager.html b/zh_CN/agentscope.manager.html
index c999ab5e4..56e02da3a 100644
--- a/zh_CN/agentscope.manager.html
+++ b/zh_CN/agentscope.manager.html
@@ -221,7 +221,7 @@ agentscope.manager package
-
-save_image(image: str | ndarray | bytes, filename: str | None = None) str [源代码]
+save_image(image: str | ndarray | bytes | Image, filename: str | None = None) str [源代码]
Save image file locally, and return the local image path.
- 参数: