def to_pil(t_img: Image) -> PILImage.Image:
    """
    Convert a towhee.types.Image into PIL.Image.Image.

    Args:
        t_img (`towhee.types.Image`):
            A towhee image.

    Returns:
        (`PIL.Image.Image`)
            A PIL image.
    """
    mode = t_img.mode

    pil_img = PILImage.fromarray(t_img, mode)

    return pil_img
Convert a towhee.types.Image into PIL.Image.Image.

Args:
t_img (`towhee.types.Image`):
A towhee image.

Returns:
(`PIL.Image.Image`)
A PIL image.
towhee/utils/pil_utils.py