我有一些想要可视化的数据。源数据的每个字节大致对应图像的一个像素值。
使用 Python 生成图像文件(位图?)的最简单方法是什么?
最佳答案
您可以使用 Pillow 创建具有像素值列表的图像:
from PIL import Image
img = Image.new('RGB', (width, height))
img.putdata(my_list)
img.save('image.png')
关于python - 在 Python 中,如何轻松地从一些源数据生成图像文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1038550/