<p>所以我正在尝试创建一个程序,它需要用RGB值保存图片。这只是我设置的一个简单测试,以确保我可以打开、获取数据,然后再次将图像与数据一起保存:</p>
<pre><code>inputIm = Image.open(args.target)
#denoises image and saves it to disk
#data = DenoiseImage(inputIm, factor, iters)
data = np.array(inputIm.getdata())
n, m = inputIm.size
print data
outputIm = Image.new("RGB", (n, m))
outputIm.putdata(data)
outputIm.save(args.fileName)
</code></pre>
<p>当我运行它时会出现这个错误:</p>
^{pr2}$
<p>但是,print数据行确实打印出一个数组,其中包含元组,所以我真的不明白我做错了什么。我对黑白图片做了完全相同的处理(“L”而不是“RGB”),并放入一个没有元组的数组中(而不是单值),这样就有效了。在</p>