docstr: Save image by pillow module.
  Currently, pillow supports only uint8 to save.
  
  Args:
      path (str): output filename
      img (numpy.ndarray): Image array to save. Image shape is considered as (height, width, channel) by default.
      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 considered as (height, width, channel)
      as_uint16 (bool):
          In this backend, this argument is always False because pillow dose not support uint16.
          If True, exception will be raised.
      auto_scale (bool) :
          Whether upscale pixel values or not.
          If you want to save float image, this argument must be True.
          In pillow backend, only float ([0, 1]) to uint8 ([0, 255]) is supported.
docstr_tok: ["Save","image","by","pillow","module",".","Currently",",","pillow","supports","only","uint8","to","save",".","Args",":","path","(","str",")",":","output","filename","img","(","numpy.ndarray",")",":","Image","array","to","save",".","Image","shape","is","considered","as","(","height",",","width",",","channel",")","by","default",".","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","considered","as","(","height",",","width",",","channel",")","as_uint16","(","bool",")",":","In","this","backend",",","this","argument","is","always","False","because","pillow","dose","not","support","uint16",".","If","True",",","exception","will","be","raised",".","auto_scale","(","bool",")",":","Whether","upscale","pixel","values","or","not",".","If","you","want","to","save","float","image",",","this","argument","must","be","True",".","In","pillow","backend",",","only","float","(","[","0",",","1","]",")","to","uint8","(","[","0",",","255","]",")","is","supported","."]
code: def imsave(
      self,
      path,
      img,
      channel_first=False,
      as_uint16=False,
      auto_scale=True,
  ):
      """
      Save image by pillow module.
      Currently, pillow supports only uint8 to save.
  
      Args:
          path (str): output filename
          img (numpy.ndarray): Image array to save. Image shape is considered as (height, width, channel) by default.
          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 considered as (height, width, channel)
          as_uint16 (bool):
              In this backend, this argument is always False because pillow dose not support uint16.
              If True, exception will be raised.
          auto_scale (bool) :
              Whether upscale pixel values or not.
              If you want to save float image, this argument must be True.
              In pillow backend, only float ([0, 1]) to uint8 ([0, 255]) is supported.
      """
      img = _imsave_before(img, channel_first, auto_scale)
  
      if img.dtype == np.uint16 or as_uint16:
          logger.warning(
              "Pillow only supports uint8 image to save. Cast img to uint8."
              "If you want to save image as uint16, install pypng or cv2 "
              "and nnabla.utils.image_utils automatically change backend to use these module."
          )
          return self.next_available(path).imsave(
              path,
              img,
              channel_first=channel_first,
              as_uint16=as_uint16,
              auto_scale=auto_scale,
          )
  
      if auto_scale and img.dtype != np.uint8:
          img = (img * 255).astype(np.uint8)
  
      if len(img.shape) == 3 and img.shape[-1] == 1:
          img = np.squeeze(img, axis=-1)
  
      Image.fromarray(img).save(path)
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/pil_backend.py
imports: from __future__ import absolute_import, division
  import numpy
  from PIL import Image
  from nnabla.logger import logger
  from .common import _imread_before, _imread_after, _imsave_before, _imresize_before, _imresize_after
  from .image_utils_backend import ImageUtilsBackend
label_desc: Use image node_id 7 for calling the PilBackend obj's underlying member method code with example usage: obj.imsave(path, img, channel_first, as_uint16, auto_scale) and returns: self