'**SUMMARY**
Combine two images as a side by side images. Great for before and after images.
**PARAMETERS**
* *side* - what side of this image to place the other image on.
choices are (\'left\'/\'right\'/\'top\'/\'bottom\').
* *scale* - if true scale the smaller of the two sides to match the
edge touching the other image. If false we center the smaller
of the two images on the edge touching the larger image.
**RETURNS**
A new image that is a combination of the two images.
**EXAMPLE**
>>> img = Image("lenna")
>>> img2 = Image("orson_welles.jpg")
>>> img3 = img.sideBySide(img2)
**TODO**
Make this accept a list of images.'

def sideBySide(self, image, side='right', scale=True):

    retVal = None
    if (side == 'top'):
        retVal = image.sideBySide(self, 'bottom', scale)
    elif (side == 'bottom'):
        if (self.width > image.width):
            if scale:
                resized = image.resize(w=self.width)
                nW = self.width
                nH = (self.height + resized.height)
                newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
                cv.SetZero(newCanvas)
                cv.SetImageROI(newCanvas, (0, 0, nW, self.height))
                cv.Copy(self.getBitmap(), newCanvas)
                cv.ResetImageROI(newCanvas)
                cv.SetImageROI(newCanvas, (0, self.height, resized.width, resized.height))
                cv.Copy(resized.getBitmap(), newCanvas)
                cv.ResetImageROI(newCanvas)
                retVal = Image(newCanvas, colorSpace=self._colorSpace)
            else:
                nW = self.width
                nH = (self.height + image.height)
                newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
                cv.SetZero(newCanvas)
                cv.SetImageROI(newCanvas, (0, 0, nW, self.height))
                cv.Copy(self.getBitmap(), newCanvas)
                cv.ResetImageROI(newCanvas)
                xc = ((self.width - image.width) / 2)
                cv.SetImageROI(newCanvas, (xc, self.height, image.width, image.height))
                cv.Copy(image.getBitmap(), newCanvas)
                cv.ResetImageROI(newCanvas)
                retVal = Image(newCanvas, colorSpace=self._colorSpace)
        elif scale:
            resized = self.resize(w=image.width)
            nW = image.width
            nH = (resized.height + image.height)
            newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
            cv.SetZero(newCanvas)
            cv.SetImageROI(newCanvas, (0, 0, resized.width, resized.height))
            cv.Copy(resized.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            cv.SetImageROI(newCanvas, (0, resized.height, nW, image.height))
            cv.Copy(image.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            retVal = Image(newCanvas, colorSpace=self._colorSpace)
        else:
            nW = image.width
            nH = (self.height + image.height)
            newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
            cv.SetZero(newCanvas)
            xc = ((image.width - self.width) / 2)
            cv.SetImageROI(newCanvas, (xc, 0, self.width, self.height))
            cv.Copy(self.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            cv.SetImageROI(newCanvas, (0, self.height, image.width, image.height))
            cv.Copy(image.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            retVal = Image(newCanvas, colorSpace=self._colorSpace)
    elif (side == 'right'):
        retVal = image.sideBySide(self, 'left', scale)
    elif (self.height > image.height):
        if scale:
            resized = image.resize(h=self.height)
            nW = (self.width + resized.width)
            nH = self.height
            newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
            cv.SetZero(newCanvas)
            cv.SetImageROI(newCanvas, (0, 0, resized.width, resized.height))
            cv.Copy(resized.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            cv.SetImageROI(newCanvas, (resized.width, 0, self.width, self.height))
            cv.Copy(self.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            retVal = Image(newCanvas, colorSpace=self._colorSpace)
        else:
            nW = (self.width + image.width)
            nH = self.height
            newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
            cv.SetZero(newCanvas)
            yc = ((self.height - image.height) / 2)
            cv.SetImageROI(newCanvas, (0, yc, image.width, image.height))
            cv.Copy(image.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            cv.SetImageROI(newCanvas, (image.width, 0, self.width, self.height))
            cv.Copy(self.getBitmap(), newCanvas)
            cv.ResetImageROI(newCanvas)
            retVal = Image(newCanvas, colorSpace=self._colorSpace)
    elif scale:
        resized = self.resize(h=image.height)
        nW = (image.width + resized.width)
        nH = image.height
        newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
        cv.SetZero(newCanvas)
        cv.SetImageROI(newCanvas, (0, 0, image.width, image.height))
        cv.Copy(image.getBitmap(), newCanvas)
        cv.ResetImageROI(newCanvas)
        cv.SetImageROI(newCanvas, (image.width, 0, resized.width, resized.height))
        cv.Copy(resized.getBitmap(), newCanvas)
        cv.ResetImageROI(newCanvas)
        retVal = Image(newCanvas, colorSpace=self._colorSpace)
    else:
        nW = (image.width + self.width)
        nH = image.height
        newCanvas = cv.CreateImage((nW, nH), cv.IPL_DEPTH_8U, 3)
        cv.SetZero(newCanvas)
        cv.SetImageROI(newCanvas, (0, 0, image.width, image.height))
        cv.Copy(image.getBitmap(), newCanvas)
        cv.ResetImageROI(newCanvas)
        yc = ((image.height - self.height) / 2)
        cv.SetImageROI(newCanvas, (image.width, yc, self.width, self.height))
        cv.Copy(self.getBitmap(), newCanvas)
        cv.ResetImageROI(newCanvas)
        retVal = Image(newCanvas, colorSpace=self._colorSpace)
    return retVal
