小编jhf*_*ric的帖子

如何将pygame Surface作为图像保存到内存(而不是磁盘)

我正在Raspberry PI上开发一个时间要求严格的应用程序,我需要通过网络发送图像.捕获我的图像时,我这样做:

# pygame.camera.Camera captures images as a Surface
pygame.image.save(mySurface,'temp.jpeg')
_img = open('temp.jpeg','rb')
_out = _img.read()
_img.close()
_socket.sendall(_out)
Run Code Online (Sandbox Code Playgroud)

这不是很有效.我希望能够将表面保存为内存中的图像并直接发送字节而无需先将其保存到磁盘.

谢谢你的建议.

编辑:电线的另一面是期望字节的.NET应用程序

python networking pygame raspberry-pi

4
推荐指数
1
解决办法
8263
查看次数

标签 统计

networking ×1

pygame ×1

python ×1

raspberry-pi ×1