''' Purpose: support image bluing transformation ''' def blue( opixel ) : ''' Returns the new pixel when performing a bluing of opixel; that is, the new pixel has zero R and G levels and the same B level as opixel ''' ored, ogreen, oblue = opixel # get RGB of opixel nred, ngreen, nblue = 0, 0, oblue # blued pixel result = ( nred, ngreen, nblue ) # set result RGB location return result if ( __name__ == '__main__' ) : import url from manip import manip # get web image of interest link = "http://www.cs.virginia.edu/~cs1112/images/mandrill/full.png" original = url.get_image( link ) new_image = manip( original, color=blue ) new_image.show() new_image.save( "blue.png" )