''' Provides gamma factor corrections ''' from PIL import Image def correction( i, gf ) : ''' returns the gamma correction for gamma factor gf for value intensity i ''' pass def pixel( p, gf ) : ''' returns a new pixel whose RGB values are gamma corrections for gamma factor gf of the RGB values of pixel p ''' pass def create( original, gf ) : ''' Returns a new image whose dimensions match that of original, where a pixel in the new image is a gamma correction for gamma factor gf of the corresponding pixel in original ''' ow, oh = original.size nw, nh = ow, oh new_image = Image.new( 'RGB', ( nw, nh ) ) for nx in range( 0, nw ) : for ny in range( 0, nh ) : nspot = (nx, ny ) ospot = nspot opixel = original.getpixel( ospot ) npixel = ... new_image.putpixel( nspot, npixel ) return new_image if ( __name__ == '__main__' ) : import url import gamma link = 'http://www.cs.virginia.edu/~cs1112/images/mandrill/full.png' original = url.get_image( link ) im = gamma.create( original, 0.25 ) im.show() im = gamma.create( original, 2.00 ) im.show() im.show()