code: def asRGB(self):
          
  
          width,height,pixels,meta = self.asDirect()
          if meta['alpha']:
              raise Error("will not convert image with alpha channel to RGB")
          if not meta['greyscale']:
              return width,height,pixels,meta
          meta['greyscale'] = False
          typecode = 'BH'[meta['bitdepth'] > 8]
          def iterrgb():
              for row in pixels:
                  a = array(typecode, [0]) * 3 * width
                  for i in range(3):
                      a[i::3] = row
                  yield a
          return width,height,iterrgb(),meta
docs: Return image as RGB pixels.  RGB colour images are passed
          through unchanged; greyscales are expanded into RGB
          triplets (there is a small speed overhead for doing this).
  
          An alpha channel in the source image will raise an
          exception.
  
          The return values are as for the :meth:`read` method
          except that the *metadata* reflect the returned pixels, not the
          source image.  In particular, for this method
          ``metadata['greyscale']`` will be ``False``.