将Numpy数组保存为图像 [英] Saving a Numpy array as an image

查看:117
本文介绍了将Numpy数组保存为图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Numpy数组类型的矩阵。我如何将其作为图像写入磁盘?任何格式都有效(png,jpeg,bmp ......)。一个重要的限制是PIL不存在。

I have a matrix in the type of a Numpy array. How would I write it to disk it as an image? Any format works (png, jpeg, bmp...). One important constraint is that PIL is not present.

推荐答案

你可以使用 PyPNG 。它是纯Python(无依赖关系)开源PNG编码器/解码器,它支持将NumPy数组写为图像。

You can use PyPNG. It's a pure Python (no dependencies) open source PNG encoder/decoder and it supports writing NumPy arrays as images.

这篇关于将Numpy数组保存为图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆