def centerCrop(im, w, h):
    """
    :param im : pil image to be cropped 
    :param w : scalar value width of  output image
    :param h : scalar value height of output image
    :returns a pil image cropped to (w,h)
    """
    o_w, o_h = im.size
    left = ( o_w - w) /2
    top = ( o_h - h) /2
    right = (o_w + w) /2 
    bottom = (o_h + h) /2
    return im.crop((left,top,right,bottom))