Yeah, I was bored, so I made a pic --> grayscale program in Pygame.
fileName = "python.gif"
red = False
green = True
blue = False
########################
from pygame.image import load, save
pic = load(fileName)
for x in range(pic.get_width()):
for y in range(pic.get_height()):
c = list(pic.get_at((x,y))[:3])
deg = (c[0]*red + c[1]*green + c[2]*blue) / (red + green + blue)
pic.fill( [deg]*3, ((x,y),(1,1)) )
save(pic, "%s_%s%s%s.bmp"%(fileName.split('.')[0],
'R'*red,
'G'*green,
'B'*blue))
The user can select if it measures the degree based on R, G or B. Or any combination of the latter. A good example of manipulating boolean values I guess.
Here's an example:
http://netpub.cstudies.ubc.ca/oleary/images/python.gif
Outputs:
http://img204.imageshack.us/img204/8374/pythong4qm.png
I think it actually works quite beautifully.
Bleeeeh. ^_^