【发布时间】:2018-05-11 20:58:19
【问题描述】:
我正在尝试将字节数组转换为PNG 图像并将其保存到特定文件夹。字节数组来自C#服务器,python客户端会收到并保存为PNG图片。
我尝试了以下方法:
reply = s.recv(4096)
image = Image.open(io.BytesIO(reply))
image.save("img1.png","PNG")
它给出以下错误:
Traceback (most recent call last):
File "C:\Users\imran.s\Desktop\UnityClient.py", line 46, in <module>
image.save("img1.png","PNG")
File "C:\python64\lib\site-packages\PIL\Image.py", line 1895, in save
self.load()
File "C:\python64\lib\site-packages\PIL\ImageFile.py", line 233, in load
"(%d bytes not processed)" % len(b))
OSError: image file is truncated (3 bytes not processed)
【问题讨论】:
标签: python sockets python-imaging-library python-sockets