code: def imsave(name, arr, format=None):
      """
      Save an array as an image.
  
      This function is only available if Python Imaging Library (PIL) is installed.
  
      .. warning::
  
          This function uses `bytescale` under the hood to rescale images to use
          the full (0, 255) range if ``mode`` is one of ``None, 'L', 'P', 'l'``.
          It will also cast data for 2-D images to ``uint32`` for ``mode=None``
          (which is the default).
  
      Parameters
      ----------
      name : str or file object
          Output file name or file object.
      arr : ndarray, MxN or MxNx3 or MxNx4
          Array containing image values.  If the shape is ``MxN``, the array
          represents a grey-level image.  Shape ``MxNx3`` stores the red, green
          and blue bands along the last dimension.  An alpha layer may be
          included, specified as the last colour band of an ``MxNx4`` array.
      format : str
          Image format. If omitted, the format to use is determined from the
          file name extension. If a file object was used instead of a file name,
          this parameter should always be used.
  
      Examples
      --------
      Construct an array of gradient intensity values and save to file:
  
      >>> from scipy.misc import imsave
      >>> x = np.zeros((255, 255))
      >>> x = np.zeros((255, 255), dtype=np.uint8)
      >>> x[:] = np.arange(255)
      >>> imsave('gradient.png', x)
  
      Construct an array with three colour bands (R, G, B) and store to file:
  
      >>> rgb = np.zeros((255, 255, 3), dtype=np.uint8)
      >>> rgb[..., 0] = np.arange(255)
      >>> rgb[..., 1] = 55
      >>> rgb[..., 2] = 1 - np.arange(255)
      >>> imsave('rgb_gradient.png', rgb)
  
      """
      im = toimage(arr, channel_axis=2)
      if format is None:
          im.save(name)
      else:
          im.save(name, format)
      return
  
file_path: catboost/contrib/python/scipy/py2/scipy/misc/pilutil.py
imports: from __future__ import division, print_function, absolute_import
  import numpy
  import tempfile
  from numpy import amin, amax, ravel, asarray, arange, ones, newaxis, transpose, iscomplexobj, uint8, issubdtype, array
label_desc: Use image node_id 3 for calling a global function with example usage: imsave(name, arr, format) without return types