我使用PIL生成了一个图像.如何将其保存到内存中的字符串?该Image.save()方法需要一个文件.
我想在字典中存储几个这样的图像.
对于异步文件保存,我可以使用aiofiles库。
要使用aiofiles库我必须做类似的事情:
async with aiofiles.open(path, "wb") as file:
await file.write(data)
Run Code Online (Sandbox Code Playgroud)
如何异步保存PIL图像?即使我使用Image.tobytes函数保存它file.write(data),保存的图像也不正确。
那么如何异步保存PIL图像呢?