Reputation: 3216
I'm trying to use PIL to show an image loaded from a list of numbers.
My entire code looks like this:
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()
and I got to the last line and get the error in the title.
What's wrong?
I'm on Windows, and using Python32 and a fresh install of both Python and PIL.
Upvotes: 0
Views: 2483
Reputation: 1123400
img.putdata()
returns None
; it alters the image in place.
Just use:
img = Image.new("L", LR_DIM)
img.putdata(LR[0])
img.show()
Upvotes: 4