code: def _read_image_pil(file, dtype, color, alpha):
      f = Image.open(file)
      try:
          if color:
              if f.mode == "RGBA":
                  img = f.convert("RGBA")
              else:
                  img = f.convert("RGB")
          else:
              img = f.convert("L")
          img = np.array(img, dtype=dtype)
          if img.shape[-1] == 4:
              img = _handle_four_channel_image(img, alpha).astype(
                  dtype, copy=False
              )
      finally:
          if hasattr(f, "close"):
              f.close()
  
      if img.ndim == 2:
          # reshape (H, W) -> (1, H, W)
          return img[np.newaxis]
      else:
          # transpose (H, W, C) -> (C, H, W)
          return img.transpose((2, 0, 1))
  
file_path: chainercv/chainercv/utils/image/read_image.py
imports: from __future__ import division
  import chainer
  import numpy
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: _read_image_pil(file, dtype, color, alpha) and returns: img, img