def crop_image(img: np.ndarray, box: Tuple[int, int, int, int], expand_ratio: float = 1.0) -> np.ndarray:
    """
    Crop an image by box and expand by expand_ratio.

    Args:
        img (np.ndarray): Input image (image read using cv2).
        box (Tuple[int, int, int, int]): Coordinates of the cropping box (left, upper, right, lower).
        expand_ratio (float, optional): A ratio to expand the cropping box (default is 1.0).

    Returns:
        np.ndarray: Cropped image.
    """
    W, H = img.shape[1], img.shape[0]
    x1, y1, x2, y2 = expand_roi(box, ratio=expand_ratio, max_box=[0, 0, W, H])

    cropped_img = img[y1:y2, x1:x2]

    return cropped_img

    Crop an image by box and expand by expand_ratio.

    Args:
        img (np.ndarray): Input image (image read using cv2).
        box (Tuple[int, int, int, int]): Coordinates of the cropping box (left, upper, right, lower).
        expand_ratio (float, optional): A ratio to expand the cropping box (default is 1.0).

    Returns:
        np.ndarray: Cropped image.
    
scripts/easyphoto_utils/tryon_utils.py