#returns copy of picture rotated 90 degrees def rotate(pic): w=getWidth(pic) h=getHeight(pic) pic2=makeEmptyPicture(h,w) for px in getPixels(pic): x=getX(px) y=getY(px) sourcepx=getPixel(pic2,h-y+1 ,x ) c=getColor(px) setColor(sourcepx,c) return pic2 #the demo selects a picture, displays several #successive reductions, and then several successive #enlargements. def rotate_demo(): p=makePicture(pickAFile()) show(p) p=rotate(p) show(p)