code: def as_rgb(r, g, b):
      """
      rgb = as_rgb(r, g, b)
  
      Returns an RGB image with ``r`` in the red channel, ``g`` in the green, and
      ``b`` in the blue. The channels are contrast stretched.
  
      If any of the channels is `None`, that channel is set to zero. The same can
      be achieved by passing ``0`` as that channels value. In fact, passing a
      number as a channel value will set the whole channel to that value.
  
      Examples
      --------
  
      This shows a nice looking picture::
  
          z1 = np.linspace(0, np.pi)
          X,Y = np.meshgrid(z1, z1)
          red = np.sin(X)
          green = np.cos(4*Y)
          blue = X*Y
  
          plt.imshow(mahotas.as_rgb(red, green, blue))
  
      Notice that the scaling on the ``blue`` channel is so different from the
      other channels (from 0..2500 compared with 0..1), but ``as_rgb`` stretches
      each channel independently.
  
      Parameters
      ----------
      r,g,b : array-like or int, optional
          The channels can be of any type or None.
          At least one must be not None and all must have the same shape.
  
      Returns
      -------
      rgb : ndarray
          RGB ndarray
      """
      for c in (r, g, b):
          if c is not None:
              c = np.array(c)
              shape = c.shape
              if shape != ():
                  break
      else:
          raise ValueError(
              "mahotas.as_rgb: Not all arguments can be None"
          )
  
      def s(c):
          if c is None:
              return np.zeros(shape, np.uint8)
          c = np.asanyarray(c)
          if c.shape == ():
              c = np.tile(c, shape)
              return c.astype(np.uint8, copy=False)
          elif c.shape != shape:
              sh = lambda c: (c.shape if c is not None else " . ")
              raise ValueError(
                  "mahotas.as_rgb: Not all arguments have the same shape. Shapes were : %s"
                  % [sh(r), sh(g), sh(b)]
              )
          return stretch(c)
  
      return np.dstack([s(r), s(g), s(b)])
  
imports: from __future__ import division
  import numpy
  from .internal import _check_2
label_desc: Use image node_id 3 for calling a global function with example usage: as_rgb(r, g, b) and returns: np, stretch, np, c