def rescale(image, shape):
 assert (len(image.shape) == 3)
 assert (len(shape) == 2)
 i = pil_from_ndarray(image)
 ensure_Image()
 i.thumbnail([shape[1], shape[0]], Image.ANTIALIAS)
 rval = ndarray_from_pil(i, dtype=image.dtype)
 return rval

def rescale ( image , shape ) : assert ( len ( image . shape ) == 3 ) assert ( len ( shape ) == 2 ) i = pil_from_ndarray ( image ) ensure_Image ( ) i . thumbnail ( [ shape [ 1 ] , shape [ 0 ] ] , Image . ANTIALIAS ) rval = ndarray_from_pil ( i , dtype = image . dtype ) return rval
scale image by a certain factor .