We need to use nested loops to address each pixel. They will
look something like:
for x in range(1,getWith(pic)):
for y in range(1, getHeight(pic):
pixel=getPixel(pic, x, y)
Now we can use this to do all sorts of manipulations, but we will start with mirroring vertically.
![]()
To run this program in the command area we would type:
>>> pic=makePicture(pickAFile())
>>> show(pic)
>>> mirror(pic)
>>> repaint(pic)
So here is the effect of mirroring the ice picture from earlier:
|
|
We can use this technique twice to mirror bottom to top as well:

