def duplicateHorz2(): #Allow the user to pick up an image file file = pickAFile() #now convert the image in JES format pic = makePicture(file) orig_width = getWidth (pic) orig_height = getHeight (pic) new_pict = makeEmptyPicture (orig_width*2, orig_height) for opix in getPixels (pic): x = getX( opix ) y = getY (opix ) npix1 = getPixel (new_pict, x, y) npix2 = getPixel (new_pict, x+orig_width, y) c = getColor (opix) setColor(npix1, c) setColor(npix2, c) openPictureTool(new_pict) # rotates the image 90 degrees counter clockwise def rot90ccw(pict): # Set up the source and target pictures wid = getWidth (pict) hgt = getHeight (pict) canvas = makeEmptyPicture(hgt, wid) # Now, do the actual copying--swap X & Y! targetX = 1 for sourceX in range(1,getWidth(pict)): targetY = 1 for sourceY in range(1,getHeight(pict)): color = getColor(getPixel(pict,sourceX,sourceY)) setColor(getPixel(canvas, targetY, wid - targetX), color) targetY = targetY + 1 targetX = targetX + 1 return canvas def rotateDriver(): # Set up the source and target pictures file = pickAFile() pict = makePicture(file) show(pict) canvas = rot90ccw (canvas) show(canvas) canvas2 = rot90ccw (canvas) show(canvas2) canvas3 = rot90ccw (canvas2) show(canvas3) canvas4 = rot90ccw (canvas3) show(canvas4) def rotateDriver2(times, showIntermediate): # Set up the source and target pictures file = pickAFile() pict = makePicture(file) show(pict) newPict = pict for count in range ( 0, times ): newPict = rot90ccw (newPict) if (showIntermediate == 1): show(newPict) show (newPict)