For simplicity, the following instructions assume that the input is a square image, i.e. an image where width and height are equal!
# Flip Image (doesn't work) def flipimage(filename): pic = makePicture(filename) targetX = 0 for sourceX in range(0,getWidth(pic)): targetY = 0 for sourceY in range(0,getHeight(pic)): color = getColor(getPixel(pic,sourceX,sourceY)) setColor(getPixel(pic,targetY,targetX),color) targetY = targetY + 1 targetX = targetX + 1 show(pic) return pic
temp = a a = b b = tempAdapt this idea to fix the above code. Hint: instead of assignments, use appropriate get/set functions.
submit 1710 lab07 lab07.py