def to_pil(img: Image):
    """
    Convert a towhee.types.Image into PIL.Image.Image.

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

    Returns (`PIL.Image.Image`):
            A PIL image.
    """
    # pylint: disable=import-outside-toplevel
    from towhee.utils.pil_utils import PILImage

    return PILImage.fromarray(img, img.mode)
Convert a towhee.types.Image into PIL.Image.Image.

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

Returns (`PIL.Image.Image`):
A PIL image.
towhee/types/image_utils.py