code: def resample_image(arr, max_size=400):
      
      dim = np.max(arr.shape[0:2])
      if dim < max_size:
          max_size = dim
      x, y, _ = arr.shape
      sx = int(np.ceil(x / max_size))
      sy = int(np.ceil(y / max_size))
      img = np.zeros((max_size, max_size, 3), dtype=arr.dtype)
      arr = arr[0:-1:sx, 0:-1:sy, :]
      xl = (max_size - arr.shape[0]) // 2
      yl = (max_size - arr.shape[1]) // 2
      img[xl:arr.shape[0]+xl, yl:arr.shape[1]+yl, :] = arr
      return img
docs: Resamples a square image to an image of max_size