code: def convert(image, shape, gray=False, dtype='float64', normalize='max'):
      
  
      image = image.astype(dtype)
  
      if gray:
          image[..., 0] *= 0.2126
          image[..., 1] *= 0.7152
          image[..., 2] *= 0.0722
          image = np.sum(image, axis=2)
  
      if shape is not None:
          image = skimage.transform.resize(image, shape, mode='constant')
          image = image.astype(dtype)
  
      if normalize == 'max':
          image /= image.max()
      elif normalize == 'sum':
          image /= image.sum()
      else:
          assert False
  
      return image
docs: Convert image to standardized format.
  
      Several properties of the input image may be changed including the shape,
      data type and maximal value of the image. In addition, this function may
      convert the image into an ODL object and/or a gray scale image.