def visualize_pred_mask(
    mask: Image.Image | torch.Tensor,
    *,
    mode: Literal["contour", "fill", "binary", "L", "1"] = "binary",
    color: tuple[int, int, int] = (255, 0, 0),
    alpha: float = 0.5,
    background_color: tuple[int, int, int, int] = (0, 0, 0, 0),
) -> Image.Image:
    """Visualize a prediction mask.

    This is a convenience wrapper around :func:`visualize_mask` specifically for
    prediction masks. It provides the same functionality with default parameters
    suitable for prediction visualization.

    Args:
        mask (Image.Image | torch.Tensor): Input mask to visualize. Can be either a
            PIL Image or PyTorch tensor.
        mode (Literal["contour", "fill", "binary", "L", "1"]): Visualization mode.
            Defaults to ``"binary"``.
            - ``"contour"``: Draw mask boundaries
            - ``"fill"``: Fill mask regions with semi-transparent color
            - ``"binary"``, ``"L"``, ``"1"``: Return original binary mask
        color (tuple[int, int, int]): RGB color for visualizing the mask.
            Defaults to red ``(255, 0, 0)``.
        alpha (float): Opacity for the mask visualization in ``"fill"`` mode.
            Range [0, 1]. Defaults to ``0.5``.
        background_color (tuple[int, int, int, int]): RGBA color for the
            background. Defaults to transparent ``(0, 0, 0, 0)``.

    Returns:
        Image.Image: Visualized mask as a PIL Image.

    Examples:
        >>> import torch
        >>> from PIL import Image
        >>> # Create a sample binary mask
        >>> mask = torch.zeros((100, 100))
        >>> mask[25:75, 25:75] = 1
        >>> # Visualize with default settings (binary mode)
        >>> vis = visualize_pred_mask(mask)
        >>> isinstance(vis, Image.Image)
        True
        >>> # Visualize with contours in blue
        >>> vis = visualize_pred_mask(mask, mode="contour", color=(0, 0, 255))
        >>> isinstance(vis, Image.Image)
        True

    Note:
        See :func:`visualize_mask` for more details on the visualization modes and
        parameters.
    """
    return visualize_mask(mask, mode=mode, alpha=alpha, color=color, background_color=background_color)
Visualize a prediction mask.

    This is a convenience wrapper around :func:`visualize_mask` specifically for
    prediction masks. It provides the same functionality with default parameters
    suitable for prediction visualization.

    Args:
        mask (Image.Image | torch.Tensor): Input mask to visualize. Can be either a
            PIL Image or PyTorch tensor.
        mode (Literal["contour", "fill", "binary", "L", "1"]): Visualization mode.
            Defaults to ``"binary"``.
            - ``"contour"``: Draw mask boundaries
            - ``"fill"``: Fill mask regions with semi-transparent color
            - ``"binary"``, ``"L"``, ``"1"``: Return original binary mask
        color (tuple[int, int, int]): RGB color for visualizing the mask.
            Defaults to red ``(255, 0, 0)``.
        alpha (float): Opacity for the mask visualization in ``"fill"`` mode.
            Range [0, 1]. Defaults to ``0.5``.
        background_color (tuple[int, int, int, int]): RGBA color for the
            background. Defaults to transparent ``(0, 0, 0, 0)``.

    Returns:
        Image.Image: Visualized mask as a PIL Image.

    Examples:
        >>> import torch
        >>> from PIL import Image
        >>> # Create a sample binary mask
        >>> mask = torch.zeros((100, 100))
        >>> mask[25:75, 25:75] = 1
        >>> # Visualize with default settings (binary mode)
        >>> vis = visualize_pred_mask(mask)
        >>> isinstance(vis, Image.Image)
        True
        >>> # Visualize with contours in blue
        >>> vis = visualize_pred_mask(mask, mode="contour", color=(0, 0, 255))
        >>> isinstance(vis, Image.Image)
        True

    Note:
        See :func:`visualize_mask` for more details on the visualization modes and
        parameters.
    
src/anomalib/visualization/image/functional.py