''' Module: monad -- peforms one image transformation Name 1: Name 2: Email id 1: Email id 2: ''' from PIL import Image # get Pillow Image capabilities import locate, mutate, dimensions # get our modules for image transformations from PIL import Image def cw( original ) : ''' Return a new image that is a 90 degree clockwise rotation of the original ''' ow, oh = original.size nw, nh = ... # set dimensions of a clockwise rotated version of # original new_image = Image.new( 'RGB', ( nw, nh ) ) for nx in range( 0, nw ) : for ny in range( 0, nh ) : nspot = ( nx, ny ) ospot = ... # determine counter-clockwise spot in original that # is the correspondent for nspot opixel = original.getpixel( ospot ) npixel = ... # npixel should be copy of the correspondent opixel new_image.putpixel( nspot, npixel ) return new_image if ( __name__ == '__main__' ) : import url # get web image of interest link = "http://www.cs.virginia.edu/~cs1112/images/mandrill/full.png" orig = url.get_image( link ) new_image = cw( orig ) new_image.show()