im.getpixel()

I’m trying to return the value of a pixel in an image and getting wierd errors.

im.getpixel(0,0)
returns error:
TypeError: getpixel() takes exactly 2 arguments (3 given)
# I don’t count that good,but it looks like two to me…

im.getpixel(0)
returns error:
TypeError: argument must be sequence of length 2

This is Python 2.5,XP,Blender 2…46 and 2.48a

Try this and tell me what you get please.

import PIL
import Image
im = Image.open("C:Your file path.png")
im.getpixel(0,0)

You might try im.getpixel([0, 0]) since it wants a length two sequence.

nope…

im.getpixel([0, 0])
returns:

TypeError: argument must be sequence of length 2

It has to be a tuple.

im.getpixel((0,0))

Thats got it, many thanks mate!