def from_pil(pil_img: PILImage.Image) -> Image:
    '''
    Convert a PIL.Image.Image into towhee.types.Image.

    Args:
        pil_img (`PIL.Image.Image`):
            A PIL image.

    Returns:
        (`towhee.types.Image`)
            The image wrapepd as towhee Image.
    '''
    # img_bytes = pil_img.tobytes()
    # img_width = pil_img.width
    # img_height = pil_img.height
    # img_channel = len(pil_img.split())
    mode = pil_img.mode
    array = np.array(pil_img)

    t_img = Image(array, mode)

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

Args:
pil_img (`PIL.Image.Image`):
A PIL image.

Returns:
(`towhee.types.Image`)
The image wrapepd as towhee Image.
towhee/utils/pil_utils.py