将 Numpy 数组保存为图像 [英] Saving a Numpy array as an image
本文介绍了将 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屋!
查看全文