MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / load_image_async

Function load_image_async

lightx2v/utils/async_io.py:11–19  ·  view source on GitHub ↗
(path: Union[str, Path])

Source from the content-addressed store, hash-verified

9
10
11async def load_image_async(path: Union[str, Path]) -> Image.Image:
12 try:
13 async with aiofiles.open(path, "rb") as f:
14 data = await f.read()
15
16 return await asyncio.to_thread(lambda: Image.open(io.BytesIO(data)).convert("RGB"))
17 except Exception as e:
18 logger.error(f"Failed to load image from {path}: {e}")
19 raise
20
21
22async def save_video_async(video_path: Union[str, Path], video_data: bytes):

Callers

nothing calls this directly

Calls 3

openMethod · 0.80
convertMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected