code: def resize_image_with_crop_or_pad(img, target_height, target_width):
      
      h, w = target_height, target_width
      max_h, max_w, c = img.shape
  
      # crop
      img = crop_center(img, min(max_h, h), min(max_w, w))
  
      # pad
      padded_img = np.zeros(shape=(h, w, c), dtype=img.dtype)
      padded_img[:img.shape[0], :img.shape[1], :img.shape[2]] = img
  
      return padded_img
docs: Crops and/or pads an image to a target width and height.
  
      Resizes an image to a target width and height by either cropping the image or padding it with zeros.
  
      NO CENTER CROP. NO CENTER PAD. (Just fill bottom right or crop bottom right)
  
      :param img: Numpy array representing the image.
      :param target_height: Target height.
      :param target_width: Target width.
      :return: The cropped and padded image.