I am using the following code to convert a color image to a grayscale image. Why does it throw a TypeError?
#!/usr/bin/python
from PIL import Image
im = Image.open("Penguins.jpg")
pixel = im.load()
width, height = im.size
for x in range(width):
for y in range(height):
R,G,B = pixel[x,y]
pixel[x,y] = ((0.299*R+0.587*G+0.114*B),(0.299*R+0.587*G+0.114*B),(0.299*R+0.587*G+0.114*B))
im.save("Penguins_new.jpg")