def flipDiagonal(): file = pickAFile() pict = makePicture (file) # get the width, height and midwid, midhgt wid = getWidth (pict) hgt = getHeight(pict) pict1 = makeEmptyPicture(hgt,wid) # flip along the diagonal for x in range(1,wid): for y in range(1,hgt): originalPixel = getPixel(pict, x, y) newPixel = getPixel(pict1, y, x) c = getColor(originalPixel) setColor(newPixel,c) show (pict) show (pict1) def mirrorit(): file = pickAFile() pict = makePicture (file) # get the width, height and midwid, midhgt wid = getWidth (pict) hgt = getHeight(pict) midwid=wid/2 midhgt = hgt / 2 print wid, hgt, midwid, midhgt # mirror the upper right corner for y in range(1,midhgt): for xOffset in range(1,midwid): pright = getPixel(pict, xOffset+midwid,y) pleft = getPixel(pict, midwid-xOffset,y) c = getColor(pleft) setColor(pright,c) # mirror the lower left coner for yOffset in range(1,midhgt): for x in range(1,midwid): pbottom = getPixel(pict, x, yOffset+midhgt) ptop = getPixel(pict, x, midhgt-yOffset) c = getColor(ptop) setColor(pbottom,c) # mirror the lower right coner for yOffset in range(1,midhgt): for xOffset in range(1,midwid): plrc = getPixel(pict, xOffset+midwid, yOffset+midhgt) pulc = getPixel(pict, midwid-xOffset, midhgt-yOffset) c = getColor(pulc) setColor(plrc,c) show (pict)