'**SUMMARY**
This method resizes an image based on a width, a height, or both.
If either width or height is not provided the value is inferred by keeping the aspect ratio.
If both values are provided then the image is resized accordingly.
**PARAMETERS**
* *width* - The width of the output image in pixels.
* *height* - The height of the output image in pixels.
**RETURNS**
Returns a resized image, if the size is invalid a warning is issued and
None is returned.
**EXAMPLE**
>>> img = Image("lenna")
>>> img2 = img.resize(w=1024) # h is guessed from w
>>> img3 = img.resize(h=1024) # w is guessed from h
>>> img4 = img.resize(w=200,h=100)'

def resize(self, w=None, h=None):

    retVal = None
    if ((w is None) and (h is None)):
        logger.warning('Image.resize    has    no    parameters.    No    operation    is    performed')
        return None
    elif ((w is not None) and (h is None)):
        sfactor = (float(w) / float(self.width))
        h = int((sfactor * float(self.height)))
    elif ((w is None) and (h is not None)):
        sfactor = (float(h) / float(self.height))
        w = int((sfactor * float(self.width)))
    if ((w > MAX_DIMENSION) or (h > MAX_DIMENSION)):
        logger.warning("Image.resize    Holy    Heck!    You    tried    to    make    an    image    really    big    or    impossibly    small.    I    can't    scale    that")
        return retVal
    scaled_bitmap = cv.CreateImage((w, h), 8, 3)
    cv.Resize(self.getBitmap(), scaled_bitmap)
    return Image(scaled_bitmap, colorSpace=self._colorSpace)
