I need to write a function that get an image and return a mirror image (the Y coordinate never change), without using any mirror or flip 
module from PIL.  

I have to write it myself.
I'm getting an error msg: 

```
IndexError: image index out of range

```

what am I missing here?

thank you.

```
from os.path import exists
import tkMessageBox, tkFileDialog
from PIL import Image, ImageTk, ImageFilter

def flip(im):
    '''Flips a picutre horizontally, and returns a new image that is a mirror view of the original'''
    org=Image.open(im)
    new=Image.new("RGB",org.size)   
    for x in range(org.size[0]):
        a=org.size[0]
        for y in range(org.size[1]):
            pixel=org.getpixel((x,y))
            new.putpixel((a,y),pixel)
            a-=1
    new.save("new.bmp","bmp")

```