code: def rotate_img_and_crop(img, angle):
      
      h, w, _ = img.shape
      img = scipy.ndimage.interpolation.rotate(img, angle)
      w, h = _rotatedRectWithMaxArea(w, h, math.radians(angle))
      return crop_center(img, int(h), int(w))
docs: Rotate an image and then crop it so that there is no black area.
      :param img: The image to rotate.
      :param angle: The rotation angle in degrees.
      :return: The rotated and cropped image.