I assume that you are trying to use the Image module. Here is an example:
from PIL import Image picture = Image.open("/path/to/my/picture.jpg") r,g,b = picture.getpixel( (0,0) ) print("Red: {0}, Green: {1}, Blue: {2}".format(r,g,b))
By running this on this image , I get the output:
>>> from PIL import Image >>> picture = Image.open("/home/gizmo/Downloads/image_launch_a5.jpg") >>> r,g,b = picture.getpixel( (0,0) ) >>> print("Red: {0}, Green: {1}, Blue: {2}".format(r,g,b)) Red: 138, Green: 161, Blue: 175
EDIT: To do what you want, I would try something like this
from PIL import Image picture = Image.open("/path/to/my/picture.jpg")
Gizmo
source share