I am trying to do some image processing with the following code:
Image.open('C:\\temp\\img')
width, height = im.size
im = im.resize((width*8,height*8), Image.BICUBIC)
pixdata = im.load()
for y in xrange(im.size[1]):
for x in xrange(im.size[0]):
if pixdata[x, y][0] < 165:
pixdata = (0, 0, 0, 255)
for y in xrange(im.size[1]):
for x in xrange(im.size[0]):
if pixdata[x, y][1] < 165:
pixdata = (0, 0, 0, 255)
for y in xrange(im.size[1]):
for x in xrange(im.size[0]):
if pixdata[x, y][2] > 0:
pixdata[x, y] = (255, 255, 255, 255)
however when I am doing the above i get a TypeError. The pixdata is stored on memory properly but no idea why this is giving this error.
if pixdata[x, y][0] < 165:
TypeError: 'int' object has no attribute '__getitem__'