'''This program illustrates pixel-based manipulation of images using PIL. Jeff Ondich, 31 Oct 2007 (boo!), for CS 111. This program requires you to install PIL (the Python Imaging Library), which you can get from http://www.pythonware.com/products/pil/ if it's not already installed on the computer you are using. It is already installed in the CS labs in the CMC. ''' import Image import time image = Image.open("babe.jpg") image.show() pixels = image.load() imageWidth = image.size[0] imageHeight = image.size[1] for y in range(imageHeight): for x in range(imageWidth): greenValue = pixels[x, y][1] pixels[x, y] = (0, greenValue, 0) image.save("babe-green.jpg") image.show()