def from_pil(pil_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.
    '''
    # pylint: disable=import-outside-toplevel
    import numpy as np

    return Image(np.array(pil_img), pil_img.mode)
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/types/image_utils.py