使用 python 从图像文件中获取 rgb 数据

get rgb data from image files using python

我可以做很简单的事情。 enter image description here

当我运行这段代码时,我只能得到一个像素数据。 我想从图像文件中获取所有 rgb 值。 并保存为txt文件

我该怎么办?

谢谢

pix = list(im.getdata())

将获得图像的所有 RGB 像素列表。