''' Purpose: generate random colors over a user-specified selfie ''' from PIL import Image import random import image_support # get selfie of interest reply = input( "Enter computing id: " ) who = reply.strip().lower() img = image_support.get_selfie( who ); # get selfie dimensions w, h = img.size for x in range( 0, w, 2 ) : # examining pixels in a rightward sweep for y in range( 0, h, 2 ) : # process for a given x from top to bottom # use the x and y combination as spot on the picture spot = ( x, y ) # generate a random color for the spot r = random.randrange( 0, 256 ) g = random.randrange( 0, 256 ) b = random.randrange( 0, 256 ) c = ( r, g, b ) # set the img pixel at spot to color c img.putpixel( spot, c ) # show image img.show()