''' Provide an intro to image manipulation ''' from PIL import Image # UVA official colors blue = ( 0, 47, 108 ) # UVA BLUE orange = ( 229, 114, 0 ) # UVA ORANGE def wahoo( original ) : ''' wahoo-fy a picture -- for each pixel in the original there is a 50% chance it will be the same in the copy, 25% chance it will be UVA blue, and a 25% chance it will be UVA orange ''' # get dimensions of original ow, oh = original.size # set dimensions of new image nw, nh = ow, oh # get a new appropriately sized image new_image = Image.new( 'RGB', ( nw, nh ) ) # fill in every pixel of the new image for nx in range( 0, nw ) : # consider all possible x values for ny in range( 0, nh ) : # consider all possible y values # set the spot to be filled in the new image nspot = ( nx, ny ) # determine the corresponding spot of interest in original ospot = ( nx, ny ) # get the pixel at the ospot opixel = original.getpixel( ospot ) # determine the pixel for the new image npixel = ... # set the nspot in the new image new_image.putpixel( nspot, npixel ) # return the filled in new image return new_image if ( __name__ == '__main__' ) : import url # get web image support id = input( "Enter email id: " ) # get id of interest person = url.get_selfie( id ) # get their class photo wahooed = wahoo( person ) # wahoo-them wahooed.show() # go wahoos