Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PIL:AttributeError:&x27;非类型';对象没有属性';显示';_Python_Python Imaging Library - Fatal编程技术网

Python PIL:AttributeError:&x27;非类型';对象没有属性';显示';

Python PIL:AttributeError:&x27;非类型';对象没有属性';显示';,python,python-imaging-library,Python,Python Imaging Library,我正在尝试使用PIL显示从数字列表加载的图像 我的整个代码如下所示: from PIL import Image import os, sys L = 4 #resolution increase LR_DIM = (2592, 1944) HR_DIM = (LR_DIM[0]*L, LR_DIM[1]*L) HR = [0] * (HR_DIM[0] * HR_DIM[1]) #include low-res files LR = [] LR.append([[250 for x

我正在尝试使用PIL显示从数字列表加载的图像

我的整个代码如下所示:

from PIL import Image
import os, sys

L = 4 #resolution increase

LR_DIM = (2592, 1944)
HR_DIM = (LR_DIM[0]*L, LR_DIM[1]*L)

HR = [0] * (HR_DIM[0] * HR_DIM[1]) 

#include low-res files
LR = []
LR.append([[250 for x in range(LR_DIM[0])] for y in range(LR_DIM[1])])

img = Image.new("L", LR_DIM)
img = img.putdata(LR[0])
img.show()
我到了最后一行,得到了标题中的错误

怎么了

我在Windows上,使用Python32和新安装的Python和PIL

img.putdata()
返回
None
;它会在适当的位置改变图像

只需使用:

img = Image.new("L", LR_DIM)
img.putdata(LR[0])
img.show()
img.putdata()
返回
None
;它会在适当的位置改变图像

只需使用:

img = Image.new("L", LR_DIM)
img.putdata(LR[0])
img.show()

你能发布完整的回溯吗?你能发布完整的回溯吗?谢谢!我真是太傻了!谢谢我真是太傻了!