Read image by PIL module.
    Notice that PIL only supports uint8 for RGB (not uint16).
    So this imread function returns only uint8 array for both RGB and gray-scale.
    (Currently ignore "I" mode for gray-scale (32bit integer).)

    Args:
        path (str or 'file object'): File path or object to read.
        grayscale (bool):
        size (tupple of int):
            (width, height).
            If None, output img shape depends on the files to read.
        channel_first (bool):
            This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
            Default value is False, which means the img shape is (height, width, channel).
        interpolate (str):
            must be one of ["nearest", "box", "bilinear", "hamming", "bicubic", "lanczos"].
        as_uint16 (bool):
            If you specify this argument, you can use only False for pil backend.
        num_channels (int):
            channel size of output array.
            Default is -1 which preserves raw image shape.

    Returns:
         numpy.ndarray

def imread(path, grayscale=False, size=None, interpolate="bilinear",
           channel_first=False, as_uint16=False, num_channels=-1):
    """
    Read image by PIL module.
    Notice that PIL only supports uint8 for RGB (not uint16).
    So this imread function returns only uint8 array for both RGB and gray-scale.
    (Currently ignore "I" mode for gray-scale (32bit integer).)

    Args:
        path (str or 'file object'): File path or object to read.
        grayscale (bool):
        size (tupple of int):
            (width, height).
            If None, output img shape depends on the files to read.
        channel_first (bool):
            This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
            Default value is False, which means the img shape is (height, width, channel).
        interpolate (str):
            must be one of ["nearest", "box", "bilinear", "hamming", "bicubic", "lanczos"].
        as_uint16 (bool):
            If you specify this argument, you can use only False for pil backend.
        num_channels (int):
            channel size of output array.
            Default is -1 which preserves raw image shape.

    Returns:
         numpy.ndarray
    """

    if as_uint16:
        raise ValueError("pillow only supports uint8 for RGB image."
                         " If you want to load image as uint16,"
                         " install pypng or cv2 and"
                         " nnabla.utils.image_utils automatically change backend to use these module.")

    _imread_before(grayscale, num_channels)

    pil_img = Image.open(path, mode="r")

    img = pil_image_to_ndarray(pil_img, grayscale, num_channels)

    return _imread_after(img, size, interpolate, channel_first, imresize)