code: 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
  
imports: from pathlib import PosixPath
  from typing import Union
  import numpy
  from towhee.utils.log import engine_log
  from towhee.types import Image
label_desc: Use image node_id 2 for calling a global function with example usage: from_pil(pil_img) and returns: t_img